microsoft access help database programing developer
Back to Access Experts About Access Experts Access Experts Websites Access Experts Team Access Experts Services Access Experts Case Studies Access Expert Tips Contact Access Experts OUR BLOG
 
 
How to create Outlook message from Access
by Juan Soto
10/10/2009

Control Outlook from Access
Note: If you need to send out a massive amount of emails this code is not for you, instead we recommend FMS's Total Access Emailer.

Note 2: You must add a reference to Outlook in your Access project in order for this code to work, if you need an alternate version that does not require it then look at the next section of this post below:

    Dim objOutlook As Outlook.Application
    Dim objOutLookMsg As Outlook.MailItem
    Dim strBody as String

    strBody = "Insert you body message here."
    Set objOutlook = New Outlook.Application
    Set objOutLookMsg = objOutlook.CreateItem(0) 
    With objOutLookMsg
        .To = "w@what_Ever.com"
        .CC = "any@what_ever.com"
        .Subject = "Enter Your Subject Here"
        .Body = strBody
        .Send
    End With

Code without a reference to Outlook:
    Dim objOutlook As Object
    Dim objOutLookMsg As Object
    Dim strBody as String

    strBody = "Insert you body message here."
    Set objOutlook = CreateObject("Outlook.Application")
    Set objOutLookMsg = objOutlook.CreateItem(0) 
    With objOutLookMsg
        .To = "w@what_Ever.com"
        .CC = "any@what_ever.com"
        .Subject = "Enter Your Subject Here"
        .Body = strBody
        .Send
    End With


If you like this tip you will be delighted with our service! Call or write us today for a free quote regarding your computer needs.

Publish this article in your own corporate newsletter or publication! Contact us to obtain a free license.


Home | About Us Why PCExperts | Team | Services | Newsletter | Contact Us
Copyright © 2004