Access vba - determine if a outlook email created is still open
Posted on 2011-02-15
Currently create an outlook email in access and open to allow changes and review before sending.
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(0)
.To = varTo
.Subject = strSubject
.HTMLBody = strBody
.mileage = intID
Set objOutlook = Nothing
Set objOutlookMsg = Nothing
At this stage email not saved in drafts and I would prefer not to so user can just cancel email if they don't want it.
If user sends email I am reading the email by looking it up in outlook and updating the database with email info - this all works fine. This is done when user exits form that created email.
Issue is that the user might leave email open and exit form before they send.
I would like to pick up that the email is still open on the screen when exiting form. (and then I'l look for it again later.)
Is there a way to check email that is open on screen and loop through then - this email is not actually stored in outlook yet. (I am recording a unique ID for each email created in the Mileage field so I can identify the email easy enough - its just how to get to it)