From Access vba create a new email and force the new Message Window to the top

Chuck Coleman 106 Reputation points
2021-08-20T01:05:42.893+00:00

Hi, I have an Access application. When the user has an Access form open, there is a button with VBA code behind it that captures certain Access data and asks Outlook to create a new email message addressed to email address data from the form. That works fine. The problem I'm having is when Access tells Outlook to create the new email message, the Access application remains the focus and the new email shows up on the task bar. If you're not paying attention or don't know to look there, you think nothing happened. The code I have after the body of the new email is populated is:

.Attachments.Add strHyperlinkFile
.Display
oApp.ActiveWindow.Activate

End With
Set oEmail = Nothing
Set oApp = Nothing

What am I doing wrong and how do I get the new email message to pop up on top of Access so the user sees it and can change any of the content of the email?

Thanks!

Microsoft 365 and Office | Access | Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. DBG 2,456 Reputation points Volunteer Moderator
    2021-08-20T16:19:28.177+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.