A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

VBA Code to put in Access that will send an Email with Attachments



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 24th 06, 10:37 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 5
Default VBA Code to put in Access that will send an Email with Attachments

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
  #2  
Old April 9th 06, 06:30 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
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.

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to apply vba code to OL2003 forms ? TimR Outlook - Using Contacts 1 February 17th 06 05:41 PM
VBA Code to check Task Status [email protected] Outlook and VBA 2 February 3rd 06 07:16 PM
Delete Custom Outlook Control thru Access VBA Sue Mosher [MVP-Outlook] Outlook - Using Forms 0 January 20th 06 06:29 PM
Tough One - Update Pivot Chart in Access Report using VBA? jer99 Outlook and VBA 2 January 19th 06 11:29 PM
Running query from Access Form commmand using VBA code Berny Outlook and VBA 4 January 16th 06 03:12 PM


All times are GMT +1. The time now is 09:25 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.