Controlling Ms Outlook from Access

P

Paul Donnelly

Hi Guys,

I am looking for help to get Access 2002 to open Ms
Outlook. With depending on which button I press in an
Access Form will have a different email address and topic.

Does anyone know an easy way to do this?

Many Thanks,
Pau
 
C

Cheryl Fischer

Here is some code you can put behind a command button that will show you how
to do this.

Dim oApp As Outlook.Application
Dim objNewMail As Outlook.MailItem

Set oApp = New Outlook.Application
Set objNewMail = oApp.CreateItem(olMailItem)
With objNewMail
.To = Me!EMailAddr
.Subject = "Put your subject here"
.Body = "Put your message here"
' If you are sending an attachment...
.Attachments.Add "Put your file name here"
.Save
.Send
End With

MsgBox "Finished sending email!"

Set oApp=Nothing

If all of your users are using the same version of Outlook as you, then use
early binding by setting a reference to the Microsoft Outlook xx.x Object
Library. If you have mixed versions of Outlook, then you will need to
investigate Late Binding, and here is a good link for that:

http://www.granite.ab.ca/access/latebinding.htm

hth,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top