Results 1 to 5 of 5
  1. #1
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398

    sending email through Access

    In Access 2010, this code works in sending a basic email within Access.
    Dim objAccount As Outlook.Account
    Dim objOutlook As Outlook.Application
    Dim objOutlookMsg As Outlook.mailitem

    'Determine the correct account
    For Each objAccount In Outlook.Application.Session.Accounts

    If objAccount = "Dispatch - Safecarautotransport.com" Then

    'Create the Outlook session.
    Set objOutlook = CreateObject("Outlook.Application")


    'Create the message.
    Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

    With objOutlookMsg
    .To = "greglcrowe@gmail.com"
    .SendUsingAccount = objAccount
    .Subject = "Safe Car Auto Transport Quote"
    '.Body = "This is the body of the message." & vbCrLf & vbCrLf
    .Send
    End With
    End If

    Next

    Set objOutlook = Nothing
    Set objAccount = Nothing
    Set objOutlookMsg = Nothing

    My question is how to add formatting to the text within the body area? I can't figure out the syntax.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If you solved this post, do you care to share with others that read these forums?

  3. #3
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    I created a variable, named it message. Then used the following statements to assign the text I wanted to the variable

    message = "Thank you for giving Safe Car Auto Transport the opportunity to assist you with your shipping needs!!"
    message = msg & Chr$(13) & Chr$(13) & "Attached is the contract for your transportation needs."

    Then in the code originally listed, I changed the following line
    .Body = message

    This did exactly what I need, at this time.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Thanks for sharing!

  5. #5
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    Thanks for reminding me!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access sending email attachments
    By wee irish in forum Access
    Replies: 1
    Last Post: 03-06-2012, 06:11 PM
  2. sending gmail email through access
    By TheShabz in forum Programming
    Replies: 20
    Last Post: 02-19-2012, 12:24 PM
  3. Sending Report from Access as attachment in Email
    By taimysho0 in forum Programming
    Replies: 16
    Last Post: 02-09-2012, 12:07 PM
  4. Replies: 3
    Last Post: 09-01-2010, 08:43 PM
  5. SENDING EMAIL MESSAGES DIRECTLY FROM ACCESS
    By Frenchos in forum Access
    Replies: 0
    Last Post: 07-20-2007, 12:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums