simora
09-12-2008, 07:41 PM
I am using Outlook to send an Excel attachment using VBA. The VBA code is in the Excel sheet. The email is sent using SendKeys to click the send button in Outlook. How can I minimize the Outlook window while waiting for sendkeys.
I dont want the user to actually see an Outlook window. Here's the end of my code that takes care of sendkeys etc..etc..
.Subject = " Sent " & " " & " " & Format(Now, "mm-dd-yyyy hh-mm ")
.Body = "No Display attempt Info..."
.Attachments.Add TotalsWb.FullName
OL.Visible = True
.Display
.WindowState = olMinimized
End With
Set mpMail = Nothing
Application.Wait Now() + TimeSerial(0, 0, 7)
SendKeys "%{s}", True
End Function
I have tried .WindowState = olMinimized
and a few other formats like Application.WindowState = wdWindowStateMinimize
Any help, ideas ? Suggestions
Thanks
I dont want the user to actually see an Outlook window. Here's the end of my code that takes care of sendkeys etc..etc..
.Subject = " Sent " & " " & " " & Format(Now, "mm-dd-yyyy hh-mm ")
.Body = "No Display attempt Info..."
.Attachments.Add TotalsWb.FullName
OL.Visible = True
.Display
.WindowState = olMinimized
End With
Set mpMail = Nothing
Application.Wait Now() + TimeSerial(0, 0, 7)
SendKeys "%{s}", True
End Function
I have tried .WindowState = olMinimized
and a few other formats like Application.WindowState = wdWindowStateMinimize
Any help, ideas ? Suggestions
Thanks