Hi folks,
I have some VBA code in Excel which loops through a list of email addresses, creates an email to each one and saves the emails in the Outlook drafts folder.
If Outlook is already running when my code starts then everything works as planned and all the emails are saved to Outlook's drafts folder.
However, if Outlook is not already running when my code starts then the FIRST email always appears in the INBOX, and not always straight away. e.g. If I run my code without Outlook loaded and immediately start up Outlook afterwards, then all the emails except the first one are present in the Drafts folder; then, about a minute or so later, Outlook's Inbox will update to show "1 unread message" which is always the first email in the list. Clicking Outlook's send/recieve button does nothing to speed up the appearance of this rogue first email.
I have worked around this odd behaviour by asking the user to start up Outlook if it is not already running, but I was just wondering whether any of you have experienced this before, or if anyone has any ideas for a less intrusive solution?
Cheers
EDIT: Forgot to say I already tried creating a "dummy" first email and just deleting it instead of saving it to the Drafts folder, but that made no difference. It seems to be the first ".Save" method on an Outlook.MailItem that causes this behaviour. Invoking the .Save method then immediately attempting to delete the saved message won't work either, because it is not in the Drafts folder, nor will it appear in the Inbox until many seconds later.
Bookmarks