S
Song Su
This code will bring outlook new email and asks user if mail sent or not.
However, new email form is minimized (flashing) and MsgBox shows at front.
How to show new email form in front of MsgBox?
Or, is there a way to detect if user clicked 'send' button of outlook new
email so I don't have to present MsgBox? If not possible, use MsgBox is
fine.
Thanks. Here is the code
Private Sub cmdHelpDesk_Click()
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Dim ctlBody As String
Dim LResponse As Integer
Set olApp = Outlook.Application
Set objMail = olApp.CreateItem(olMailItem)
With objMail
.Subject = "PO: " & Me.PONumber & " - " & Me.OfficeID.Column(1)
.To = "(e-mail address removed)"
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><BODY>" & ctlBody & "</p></BODY></HTML>"
.Display
End With
Set objMail = Nothing
Set olApp = Nothing
LResponse = MsgBox("Have you sent to ItHelpDesk?", vbYesNo, "Continue")
If LResponse = vbYes Then
Me.HD.SetFocus
Me.cmdHelpDesk.Enabled = False
Me.HD = True
Me.HDDate = Now()
Me.Dirty = False
End If
End Sub
However, new email form is minimized (flashing) and MsgBox shows at front.
How to show new email form in front of MsgBox?
Or, is there a way to detect if user clicked 'send' button of outlook new
email so I don't have to present MsgBox? If not possible, use MsgBox is
fine.
Thanks. Here is the code
Private Sub cmdHelpDesk_Click()
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Dim ctlBody As String
Dim LResponse As Integer
Set olApp = Outlook.Application
Set objMail = olApp.CreateItem(olMailItem)
With objMail
.Subject = "PO: " & Me.PONumber & " - " & Me.OfficeID.Column(1)
.To = "(e-mail address removed)"
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><BODY>" & ctlBody & "</p></BODY></HTML>"
.Display
End With
Set objMail = Nothing
Set olApp = Nothing
LResponse = MsgBox("Have you sent to ItHelpDesk?", vbYesNo, "Continue")
If LResponse = vbYes Then
Me.HD.SetFocus
Me.cmdHelpDesk.Enabled = False
Me.HD = True
Me.HDDate = Now()
Me.Dirty = False
End If
End Sub