I have a program that automates MS Outlook and I want to make sure that outlook is on Top and active when the code runs.
The problem is that the code sends an email automatically, and if Outlook is already open but minimized, a security form pops-up in the background, and the user has no idea.
Before I create and send the email, I want to pop MS Outlook to the front so that they can see the security dialog without having to click the start bar.
Here is the beginning of the code:
I was thinking I could use the SHOWWINDOW api call, but I cannot figure out how to get a handle (hWnd) to Outlook (the application object does not expose hWnd).Code:Dim appOutlook As Outlook.Application Dim miMail As Outlook.MailItem Dim rsIntroEmailInfo As DAO.Recordset Dim strFileName As String Dim lngTemp As Long Set appOutlook = New Outlook.Application 'Make sure Outlook is shown and maximized Set miMail = appOutlook.CreateItem(olMailItem)
So, does anyone know how I could either
A)Make outlook active and maximized
or
B)Get a hWnd to an Outlook.Application object
?
Thanks guys!!
--Ben




Reply With Quote