+ Reply to Thread
Results 1 to 2 of 2

Intermittent error with email generation macro - pasting from excel to outlook mail

  1. #1
    Registered User
    Join Date
    09-04-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Intermittent error with email generation macro - pasting from excel to outlook mail

    I have a macro that pastes a range into an email it generates. It works great, but not every time. Sometimes I get a runtime error 91: Object Variable or With Block Variable not Set. This usually occurs when I've restarted my computer, reopen the workbook, or just let the workbook sit for a while. If I hit End on the error and try again, it works perfectly.

    Another problem is that it will paste into any email draft I have already open instead of the one it opens. This isn't a fatal flaw for the application, but I wonder if the previous problem isn't related to this. Could making the email that it creates become the "active" item solve both problems? How is this done?

    The line that is highlighted by debugging is the paste line. Although I swear it has highlighted other lines before as well. I've played around with this a lot and I haven't been able to narrow down why the problem is so intermittent.
    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    02-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    187

    Re: Intermittent error with email generation macro - pasting from excel to outlook mail

    My first stop for all e-mail related VBA queries is Ron de Bruin. The following page should help:

    http://www.rondebruin.nl/win/s1/outlook/bmail2.htm

+ 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. vba pull data from outlook body of email through email or subject of mail into excel
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-01-2014, 04:37 AM
  2. Replies: 7
    Last Post: 08-11-2012, 02:39 PM
  3. Replies: 2
    Last Post: 08-01-2012, 02:47 PM
  4. Auto email generation and sending through outlook before one month of contract end da
    By kumar_shri in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-24-2011, 06:18 AM
  5. Code for Creating outlook mail then pasting to BCC field?
    By methodman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-22-2010, 01:57 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