Results 1 to 3 of 3
  1. #1
    matey56 is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jul 2020
    Posts
    188

    Formatting emails from Access

    Hello,
    I have coded a button on my form to send an email to people I designate. The body of the email will come from a field entitled "Comments". How can I keep the formatting from the Comments field (hard returns, bullets, etc.) when I compose the email. Currently it puts the text in the email fine, but it's just one large paragraph with no formatting.

    Here is the code I'm using right now:

    Private Sub cmd_email_CRM_Click()


    Dim Msg As String


    Msg = "Dear " & CRM & ",<P>" & _
    Please review the notes below." & "<P>" & Comments


    Dim O As Outlook.Application
    Dim M As Outlook.MailItem


    Set O = New Outlook.Application
    Set M = O.CreateItem(olMailItem)


    With M
    .BodyFormat = olFormatHTML
    .HTMLBody = Msg


    .Subject = Test
    .SentOnBehalfOfName = "xyz@abc.com"
    .Display

    End With


    Set M = Nothing
    Set O = Nothing




    End Sub

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,936
    presumably your comments field is set to rich text?

    I've not experimented but suggest trying

    rtfBody

    rather than htmlBody

    since rich text coding although similar is not the same a html

  3. #3
    matey56 is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jul 2020
    Posts
    188
    Quote Originally Posted by CJ_London View Post
    presumably your comments field is set to rich text?

    I've not experimented but suggest trying

    rtfBody

    rather than htmlBody

    since rich text coding although similar is not the same a html
    Actually the comments field was plain text. I changed it to rich text and and it works. How could it have been that easy?!

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

Similar Threads

  1. Emailing a Report from Access
    By Robert2150 in forum Access
    Replies: 5
    Last Post: 11-28-2017, 01:19 PM
  2. Emailing using ACCESS
    By Maxton in forum Access
    Replies: 1
    Last Post: 11-01-2012, 02:53 PM
  3. emailing in access 2010
    By griffin.92 in forum Forms
    Replies: 3
    Last Post: 06-04-2011, 11:30 AM
  4. Pop-up when emailing from Access
    By tgavin in forum Access
    Replies: 5
    Last Post: 05-02-2011, 10:56 AM
  5. EMailing Through Access
    By mamta in forum Programming
    Replies: 5
    Last Post: 02-15-2010, 01:07 PM

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