Joe_Canadian
New Member
- Joined
- May 23, 2008
- Messages
- 33
I have a macro that opens and populates an Outlook Email, and displays it for editing. What I would like to do is have a way to determine if the user has sent it or not, and have some code run if they closed the email instead of sending it.
Basically how do I do the bold line?
Rich (BB code):
Public Sub SendNotification()
Call AsgVar 'Routine which declares and intializes common variables
Dim strTMP As String, sTo As Variant, sCC As String, sBCC As String, sSubject As String, strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error GoTo Error_Handler
[Bunch of code assigning values to all of the strings]
With OutMail
.To = sTo
.CC = sCC
.BCC = sBCC
.Subject = sSubject
.Body = strbody
.Attachments.Add "C:\BATTERY_ANALYSIS\" & strFileName
If Not (ReplaceSheet = False Or ReplaceSheet = Null)Then .Attachments.Add RepDoc
.Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
If user hit red close button instead of send then
[code to run]
Else
MsgBox ("Notification sent to " & strPlannerEmail & "@company.com")
End If
[different unrelated code]
end sub
Basically how do I do the bold line?