Emailing from Access

mjdavie

Registered User.
Local time
Today, 18:26
Joined
Sep 17, 2001
Messages
34
I use the code below for emailing attachments

My trouble is that I need to automate this process and therefore want to remove the EmailSend.Display line of code. However when I do this outlook will not send the e-mail (I get no error messages, but I never receive the mail) but the code works perfectly when I leave this line of code in.

Any Suggestion would be greatly appreciated

Dim EmailApp, NameSpace, EmailSend As Object

Set EmailApp = CreateObject("Outlook.Application")
Set NameSpace = EmailApp.getNameSpace("MAPI")
Set EmailSend = EmailApp.CreateItem(0)

EmailSend.To = "Davies Matthew J (ISeLS NSG)"
EmailSend.Subject = "Here is your attachment"
EmailSend.Attachments.Add "C:\WebServerUG.doc"
EmailSend.Display

Set EmailApp = Nothing
Set NameSpace = Nothing
Set EmailSend = Nothing

Thanks in advance
 
The problem is that when you remove that line of code, all the routine is does is create a message, but doesn't do anything with it.

Try replacing

EmailSend.Display

with

EmailSend.Send

HTH.

Matt.
 
Thanks

Cheers MattS Works a treat - very much appreciated
 
Hi,

Couldn't help but try this. I have simlar code, but it doesn't start my email client.

I'm trying to send via Lotus Notes, I put ref's for Lotus Notes and Domino hoping this would be sufficient, but I'm getting an error of "ActiveX component can't create object."

Any suggestions??

Thanks,
 

Users who are viewing this thread

Back
Top Bottom