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.
Bookmarks