Steve
Steve

Reputation: 1199

Adding external attachment an mailing from Access

I am trying to send e-mail from MS Access using VBA but cannot use the sendobject function as this doesn't support external file attachment.

Does anyone know how I can do this?

Thanks

Upvotes: 1

Views: 451

Answers (4)

David-W-Fenton
David-W-Fenton

Reputation: 23067

For an omnibus answer to this question (emailing from Access), see Tony Toews's Access EMail FAQ. Tony recommends doing it directly via Winsock as this avoids any need to worry about versions of components like CDO or distributing DLLs or installing ActiveX controls. The downside, as Tony admits, is that it's substantially more code-intensive.

Upvotes: 1

Oorang
Oorang

Reputation: 6780

If you are going to use the CDO solution (http://www.paulsadowski.com/WSH/cdo.htm) then you should be aware that as of Office 2007 CDO is not bundled with Outlook anymore. If you are going to use a CDO solution you will need to download the CDO library here and make sure that said library is also installed on any machine you plan on deploying your solution to. Another alternative would be Outlook Redemption. But either will work fine. And both will require deployment.

Upvotes: 1

JeffO
JeffO

Reputation: 8053

CDO seems to work best. You can Google CDO.Message or check out this link: http://www.paulsadowski.com/WSH/cdo.htm

Upvotes: 0

Bogdan_Ch
Bogdan_Ch

Reputation: 3336

One can use MAPISession control in VB 6.0, so I suppose it will be available in VBA too.

Using the MAPI Controls

Another way is to use Outlook object model, but it will require MS Outlook to be installed. However most users that have Access, usually have Outlook on their desktops too. See How to automate Outlook by using Visual Basic

And yet another one decision - you can use .NET (VB.NET for exmaple) to write a very small component that will use System.Net.Mail to compose and send SmtpMail. For you as VBA developer it will not be very hard. You can write one class with a single function SendEmail. Then you can expose this class to COM, see Exposing .NET Framework Components to COM Then you will have an ActiveX DLL that you can call from your VBA project (using CreateObject("") and so on)

Upvotes: 1

Related Questions