Send an email...

S

socka

How would i send an email through outlook......from an access data project (adp) file
 
K

KD

1. In the Access VBA Editor (Alt-F11), select "Tools - References", then
check "Microsoft Outlook 9.0 Object Library".
2. Create the following procedure in a code module

Sub SendOutlookMail()
Dim objOL As Outlook.Application
Set objOL = CreateObject("Outlook.Application")

Dim msg As Outlook.MailItem
Set msg = objOL.CreateItem(olMailItem)

With msg
.To = "(e-mail address removed)"
.Subject = "Test"
.Body = "This is my message"
.Save
'Take a look at the saved message in your "Draft" folder first,
'to make sure all's well before uncommenting the next line
'.Send
End With

Set objOL = Nothing
Set msg = Nothing
End Sub

Hope this helps,
Klaus
 

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