View Single Post
  #1  
Old July 19th 07, 06:38 PM posted to microsoft.public.outlook.program_vba
gary
external usenet poster
 
Posts: 110
Default Outlook within Excel, get return code to know if user pressed SEND

Question: Using the Outlook object model within Excel, can I get the return
code to know if the Sender pressed the SEND button?


I use the following code within Excel to send Outlook email. I would like
to know how to determine if the user actually pressed the SEND button within
Outlook. I will use the return code to log (or not) the activity. The
sender must have the option to send or not. I am using this form vs the send
mail dialog because this form allows the customization of the EmailBody based
on information contained on the row associated with the recipient.

I have checked both the Excel and Outlook communities and haven't found the
answer. In addition, I have done a web search using "outlook object model
email send" as the criteria and have found some very interesting stuff, but
have not been able to get an answer (that I understand). Any help would be
appreciated.

Thanks, Regards,

Gary

'
'Code segment – send an email with a custom letter based on recipient
information 'contained in the row
'
With OutMail
.to = EmailTo
.CC = ""
.BCC = ""
.Subject = EmailSubject
.Body = EmailBody
.Display
End With
'
'Now check the return code. Did the sender press the send button, or did
the user 'Close/Exit?
'
If sent Then Log_it

'done

Ads