Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Outlook To New Email

Status
Not open for further replies.

Bill6868

Technical User
Mar 20, 2007
96
US
At the beginning of each month we email a publication (.pdf) to our contacts (about 350 contacts). I have a macro that creates a make table with the email addresses then I have another macro that copies all the email addresses from the table and puts it on the clipboard. Next I open up Outlook to a new email and paste in the addresses.

Is there a simple way I can create an on click event procedure that would open up Outlook (Generally everyone already has Outlook open), and have it open up to a new email. If I could get it to do this I could insert my macros to run just prior to the code so all I would need to do is paste the clipboard data into the address field when the new email screen comes up.

I’m using Access 2007.

Any advice would be much appreciated.
 
VBA code:
DoCmd.SendObject

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PH - thank you. If it were a snake I'd have been bitten.

One more piece of advice - when the new email opens up and I paste in my addresses from the clipboard, if I cancel instead of sending I get the de-bug window - Run-time error '2501' - The SendObject action was cancelled.

Is there a way to handle this error? Below is the code I am using:

DoCmd.SetWarnings False
DoCmd.RunMacro "mcrReviewList"
DoCmd.SetWarnings True
DoCmd.RunMacro "mcrReviewToClipboard"

DoCmd.SendObject , Outlook
 
PH - I just answered my own question. I needed to add basic error handling code. Below is the final solution to my question. Thank you for pointing me in the right direction.

Private Sub Command116_Click()
On Error GoTo Err_Command116_Click

DoCmd.SetWarnings False
DoCmd.RunMacro "mcrReviewList"
DoCmd.SetWarnings True
DoCmd.RunMacro "mcrReviewToClipboard"

DoCmd.SendObject , Outlook

Exit_Command116_Click:
Exit Sub

Err_Command116_Click:
'MsgBox Err.Description
Resume Exit_Command116_Click


End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top