Sample code for sending email (1 Viewer)

aron.ridgway

Registered User.
Local time
Today, 16:56
Joined
Apr 1, 2014
Messages
148
Hi There, has anybody got any sample code for sending an email from access via outlook with VBA. I want to be able to add a hyperlink into the body of the email if possible?

many thanks
 

Acropolis

Registered User.
Local time
Today, 16:56
Joined
Feb 18, 2013
Messages
182
Code:
Dim outlookapp As Outlook.Application
Dim outlookemail As Outlook.MailItem


Set outlookapp = CreateObject("outlook.application")
Set outlookemail = outlookapp.CreateItem(olMailItem)


With outlookemail
   .To = 
   .Subject = 
   .Body = 
   .Send or .Display
End with


To add a hyperlink, you could change the body to .HTMLBody and add a hyperlink in there as you would for HTML as normal.


You will also need to add the Microsoft Outlook reference library to your project.
 

Users who are viewing this thread

Top Bottom