Hi, trying to send outlook email from Access 2007.
I am using the following code. for brevity, I replaced some of the code with comments.
This works perfectly. It shows a new outlook message, and fills in the data I wanted. I deliberately did not automate the sending itself, because I want to proof it first.Code:Dim oOutlook As Outlook.Application Dim oMsg As Outlook.MailItem Dim oRecipient As Outlook.Recipient Dim oAttachment As Outlook.Attachment Set oOutlook = New Outlook.Application Set oMsg = oOutlook.CreateItem(olMailItem) With oMsg .Display 'Set Recipients 'Set Subject 'Set message body 'Set importance 'Set attachment(s) End With Set oRecipient = Nothing Set oAttachment = Nothing Set oMsg = Nothing Set oOutlook = Nothing
All I need to do is click the "Send" button.
At least that was the plan. It never gets sent.
When I actually open up Outlook, I see the message for a moment in the outbox, and THEN it gets sent without me needing to do anything.
So it seems like Outlook itself must be visible for this to work when I click the send button.
(By the way, this same thing happens from my Quicken when I try to send a customer invoice. Quicken does everything, but the message stays in the outbox until I open Outlook.)
So, the question is: Is this a behavior I can control with an Outlook setting? If not, how do I make the ENTIRE Outlook application visible from Access VBA, rather than just the new message?
Thanks...