+ Reply to Thread
Results 1 to 7 of 7

Object variable error when adding receipts to MS Outlook

  1. #1
    Forum Contributor
    Join Date
    03-17-2013
    Location
    USA, IL
    MS-Off Ver
    Excel 2010
    Posts
    121

    Object variable error when adding receipts to MS Outlook

    Hi,

    Could you please assist me in correcting a Run time error 91 "Object variable or With block variable not set" error I get when I run the below macro. The macro works except that it does not insert the "To" and "Cc receipts in Outlook when I run it. I am currently using MS Outlook 2013 and I have valid e-mail addresses in the cell references B and C.

    The below id the portion of macro it highlights when it errors out;

    Please Login or Register  to view this content.
    The below is the macro I am running;

    Please Login or Register  to view this content.
    As always I appreciate the assistance.

    Pi

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Object variable error when adding receipts to MS Outlook

    wscontrol is never set. Therefore it is NULL at the time your statement is executed.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    03-17-2013
    Location
    USA, IL
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Object variable error when adding receipts to MS Outlook

    I appreciate it 6StringJazzer. Would you be able to tell me where in the vba I will have to Set it so it works.

    I appreciate your time.

    Pi

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Object variable error when adding receipts to MS Outlook

    There is not enough information for me to know how you are intending to use it. It can be set anywhere before it is used

    Please Login or Register  to view this content.
    but I don't know what you want to set it to.

  5. #5
    Forum Contributor
    Join Date
    03-17-2013
    Location
    USA, IL
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Object variable error when adding receipts to MS Outlook

    I have the send "To" recipients of the e-mail in cell B74 and the "CC" recipients of the e-mail in cell C74 both on the Control tab. What I want the macro to do is as part of creating a pdf and attaching to the e-mail I also want it to paste the To and CC recipients in cells B74 and C74 on the Control tab into the "sent to" and "cc" of MS Outlook and send. If that is possible.

    I appreciate your time and helping e with this.

    Pi

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Object variable error when adding receipts to MS Outlook

    You need to change your declaration for wscontrol to

    Please Login or Register  to view this content.
    Then add this line near the top of your code:

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    03-17-2013
    Location
    USA, IL
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Object variable error when adding receipts to MS Outlook

    Thank you 6StringJazzer. It works perfect now.

    Most appreciated.

    Pi*

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 05-19-2016, 05:12 AM
  2. [SOLVED] Run-time error '91': Object variable or With block variable not set when closing userform
    By bishoposiris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-10-2016, 08:59 AM
  3. Replies: 2
    Last Post: 08-22-2014, 03:55 AM
  4. [VBA] Outlook Calendar : Object Variable or With block variable not set
    By Giaccc in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2014, 09:36 AM
  5. [SOLVED] New Error/Old Code - Run Time Error 91; Object variable or With block variable not set
    By humboldtguy in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-15-2014, 12:39 AM
  6. Replies: 4
    Last Post: 07-12-2013, 12:14 PM
  7. Replies: 6
    Last Post: 12-21-2012, 08:03 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1