SendObject Action Canceled

AgDawg

Registered User.
Local time
Today, 02:57
Joined
Oct 12, 2012
Messages
24
I have some code to send an excel file but I need some kind of way to handle if the user decides to not send the email? Any help? Here is my current code:

Code:
Private Sub cmdEmailBuyer_Click()
DoCmd.SendObject acSendForm, "Computer Cost Add-ON", acFormatXLSX, "CAO", "CAO_CC", , "Computer Cost Add-ON " & Format(Date, "mm/dd/yyyy"), "Attached is a revised Computer Cost Add-Ons spreadsheet as of today per David.", True
End Sub

Also if there is some easy code to add the users outlook signature that would help as well but the user can always insert it themselves.

Thanks!
 
"Also if there is some easy code to add the users outlook signature that would help as well but the user can always insert it themselves."
The only way I see this is possible is to use a template, but then you'd need a different template for each user. Currently your code has no argument for the use of a template, but if you create a base template saved in a shared location, you could got each user to open it, add their signature and save as a template to their local machine such as: "C\EmailTemplates\SignatureTemplate.oft" or to the Users shared drive MyDocuments such as: "U\MyDocuments\EmailTemplates\SignatureTemplate.oft"
In other words each user would have a template in their own folder but would the same location with the same name for each user, then your SendObject would be
DoCmd.SendObject acSendForm, "Computer Cost Add-ON", acFormatXLSX, "CAO", "CAO_CC", , "Computer Cost Add-ON " & Format(Date, "mm/dd/yyyy"), "Attached is a revised Computer Cost Add-Ons spreadsheet as of today per David.", True, "C\EmailTemplates\SignatureTemplate.oft"

David
 
Thanks for the error trapping code. That was money right there with the message box.
 
Happy to help. You can drop the message box from the 2501 error if you want to let it be cancelled without one.
 

Users who are viewing this thread

Back
Top Bottom