Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2012
    Posts
    28

    Thumbs up Unanswered: VBA Email - How to format via HTML?

    Good Afternoon,
    I have a small piece of code starts an outlook email when the user clicks a button in an Access 2010 Form.

    Here's the code:
    Code:
    Private Sub eMail_Click()
        
        Dim olapp As Outlook.Application
        Dim olNewMail As Outlook.mailItem
        Dim eTo, eSubject, ebody As String
            
        eTo = Me.RequestEmail
        eSubject = "Request Acceptance"     
        ebody = ("We received your request on " & Me.RequestDate & " in " & Me.City & " " & Me.State & "Thank you for the request")
      
        Set olapp = New Outlook.Application
        Set olNewMail = olapp.CreateItem(olMailItem)
      
        olNewMail.To = eTo
        olNewMail.Subject = eSubject
        olNewMail.Body = ebody
        olNewMail.Display
    End Sub
    I have researched this issue but I have yet to come up with an answer yet. What's the correct syntac to format the text that goes in the email. I'm okay with using HTML but I don't know how to add it in correctly for the complier to not give me an error.

    I kept on finding other methods of writing the email code but I couldn't it get it to work.

    Thanks in advance

  2. #2
    Join Date
    Dec 2012
    Posts
    28
    Was missing
    .BodyFormat = olFormatHTML

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •