By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 985 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Send an e-mail with an attachment using Access

P: 1
Hey,

I am in the process of writing some VBA code that will do the following:

1) Create and send an e-mail using Outlook with an excel file attached. The excel files are present in a specified folder.

Any help to accomplish this will be highly appreciated.

Thanks.
Mar 15 '07 #1
Share this Question
Share on Google+
2 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Hey,

I am in the process of writing some VBA code that will do the following:

1) Create and send an e-mail using Outlook with an excel file attached. The excel files are present in a specified folder.

Any help to accomplish this will be highly appreciated.

Thanks.
Excel has a sendMail command
Expand|Select|Wrap|Line Numbers
  1.     Set wb = ActiveWorkbook
  2.     With wb
  3.         .SendMail "email address", _
  4.             "Subject line"
  5.         .Close False
  6.     End With
  7.  
You would have to nest this into a loop to run through and open each of the excel files.

Mary
Mar 17 '07 #2

P: 28
Hi,
I've always used this:
Expand|Select|Wrap|Line Numbers
  1.  On Error GoTo cmdEmail_Err
  2.     DoCmd.SendObject acSendQuery, "qryName", acFormatXLS, "", "", "", " See attachment", "", True, ""
  3. cmdEmail_Exit:
  4.     Exit Sub
  5.  
  6. cmdEmail_Err:
  7.     MsgBox "You cancelled and did not send the email", vbExclamation
  8.     Resume cmdEmail_Exit
  9.  
  10.     DoCmd.SetWarnings True
  11.     Me.Refresh
  12.  
Hope that helps.
Matt
Apr 2 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.