View Single Post
  #2  
Old April 9th 06, 05:30 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,610
Default VBA Code to put in Access that will send an Email with Attachments

That's pretty straightforward Outlook automation:

On Error Resume Next
Set ol = GetObject(, "Outlook.Application")
If ol Is Nothing Then
Set ol = CreateObject("Outlook.Application")
Set ns = ol.GetNamespace("MAPI")
' log on with desired profile
ng.Logon "Outlook Settings", "", False, False
End If
Set msg = ol.CreateItem(0)
msg.To = "name of DL"
msg.Attachments.Add "C:\excelfile1.xls"
msg.Attachments.Add "C:\excelfile2.xls"
msg.Display

For more basics, see http://www.outlookcode.com/d/vb.htm

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

wrote in message oups.com...
I am wondering if anyone out there has some VB code that I can put in
access that will open outlook email attach 2 excel files and address
it to a distribution list I have saved in outlook.

This would be huge....thanks.

Ads
 

MPAA - Western Union - Mortgage Calculator - Mortgage Calculator - Pink Ranger