O
OssieMac
I have the following code to send automated emails. The user can select
option buttons to send a purely automated text message or attach an invoice
with an accompanying automated text message.
In addition there is a checkbox option if they want to open the email to
edit the automated text message before it is sent and then send it manually.
All works fine except if the checkbox is set to open the email for editing,
it does not open as the top (Active) window ready for editing and the user
has to select it from the task bar.
Is there a way to force the email to the top to become the Active Window?
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Dim strEmailAddr As String
Dim strRef As String
Dim strBody As String
Dim strInvoicePathAndFile As String
Set objOutlook = CreateObject("Outlook.Application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = strEmailAddr
.Subject = strRef
.Body = strBody
If Me.txtInvOrTxt = "Invoice" Then
.Attachments.Add (strInvoicePathAndFile)
End If
.Display
If Me.chkEmailEdit = False Then
.Send
Else
'***********************************************
'At this point can I force the new email _
'to be the top (Active window)
'***********************************************
End If
End With
Set objEmail = Nothing
Set objOutlook = Nothing
option buttons to send a purely automated text message or attach an invoice
with an accompanying automated text message.
In addition there is a checkbox option if they want to open the email to
edit the automated text message before it is sent and then send it manually.
All works fine except if the checkbox is set to open the email for editing,
it does not open as the top (Active) window ready for editing and the user
has to select it from the task bar.
Is there a way to force the email to the top to become the Active Window?
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Dim strEmailAddr As String
Dim strRef As String
Dim strBody As String
Dim strInvoicePathAndFile As String
Set objOutlook = CreateObject("Outlook.Application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = strEmailAddr
.Subject = strRef
.Body = strBody
If Me.txtInvOrTxt = "Invoice" Then
.Attachments.Add (strInvoicePathAndFile)
End If
.Display
If Me.chkEmailEdit = False Then
.Send
Else
'***********************************************
'At this point can I force the new email _
'to be the top (Active window)
'***********************************************
End If
End With
Set objEmail = Nothing
Set objOutlook = Nothing