Pseudo code for sending Email.
Need help with Detecting whether Mail opened for Display & Editing, has been sent or the Mail has been cancelled ( Part marked in red ).
Code:
Private Sub btnSendEmail_Click()
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatRichText
.To = "email address"
.CC = " "
.Subject = "test"
.HTMLBody = "test"
.Display ' If you want to see before sending
'Here Capture whether Mail has been sent or the Send has been cancelled - How to do this ?
'pseudo code
If MailOutlook.Sent Then
(Do something )
Else
(Do something Else )
End if
End With
Exit Sub
email_error:
MsgBox "An error was encountered." & vbCrLf & "The error message is: " & Err.Description
Resume Error_out
Error_out:
End Sub
Thanks