Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access97 Automate Outlook97 Send

Status
Not open for further replies.

dbram

Technical User
Nov 20, 2002
12
US
~
Access97 Automate Outlook97 Send

Access97 database Automation code to create and send emails using Outlook97. I have little to no experience with Outlook itself.

My users do not keep Outlook launched and running. My Access code correctly creates an instance of Outlook and MAPIsp32, creates a new Outlook email message, and populates all the desired fields (To, CC, BCC, Subject, Body). The code's .Send command successfully puts the new message into the Outlook Outbox. However, the message stays in the Outbox instead of getting sent. Manually launching Outlook sends the email.

Although I understand that the Outlook CommandBar collection is different for Outlook than it is for the rest of the Office97 products, I cannot successfully automate the Outlook CommandBar Controls for Menu Bar -> Tools -> Check for New Mail to force Outlook to send. I have finally had to use a very unappealing resolution -- Close the instance of Outlook, Wait a few seconds, open a new instance, Wait, close again.

Does anyone know how to code Access97 running the Outlook97 menu option to send/receive email?

Is there another way to force Outlook97 to send its Outbox contents other than the CommandBar or re-launch methods I noted above?

Thanks to all for any input/ideas on this.

Db
~

~*~*~*~*~*~
All you need is a can of WD-40 and a roll of duct tape.
~*~*~*~*~*~
 
~
Dan:

Thinking of future users after I leave this site, I can't set Outlook options manually. Plus, I'll also have to add a variable at the beginning of the function to hold whether or not Outlook is already open when the code runs so that I can "IF it was open, THEN leave it open" when the code finishes.

Instead of re-launching Outlook, I inserted a 'wait' of 15 seconds at the end of the code right before closing Outlook. This has worked so far - Access is sending the email to Outlook's outbox, and Outlook is sending the email on my 'close'.

Thanks for your input - your suggestion made me think of the 'wait'.

db
~

~*~*~*~*~*~
All you need is a can of WD-40 and a roll of duct tape.
~*~*~*~*~*~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top