Results 1 to 2 of 2
  1. #1
    mchadwick is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Sep 2011
    Posts
    71

    HTML code inside VBA Code for email

    I have an email I am trying to create and would like to add a definition list to it. Here is my code below with the definition list below in red. It's HTML. I'm afraid I'm going to have to type it out line by line, if so I need to find out how to add spaces in front of the text.




    Private Sub Command24_Click()


    Me.[Sent] = True

    Dim Msg As String

    Msg = "Hello " & [Pref_First] & ",<br>" & _
    " text.<P>" & _
    "text.<br>"
    'insert Definition list here


    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 = "<IMG src= C:\Users\mc900136\Documents\header.jpg width=450><br>" & Msg
    .To = [Email - Primary Work]
    .CC = [Manager Email]
    .Subject = "Consolidation - Questionnaire Duel Account User"
    .Display

    End With


    Set M = Nothing
    Set O = Nothing




    End Sub
    Definition lists
    Definition lists allow you to indent without necessarily having to use bullets.
    <dl>
    <dt> Question one with options to choose from below
    <dd> Option One.
    <dd> Option Two.
    <dt> Question two with options to choose from below
    <dd> Option One.
    <dd> Option Two.
    </dl>
    And here is how this would be displayed
    Question one with options to choose from belowOption One.Option Two. Question two with options to choose from belowOption One.
    Option Two.

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,788
    Not sure what your issue is. All of your html code must be contained in your msg variable if you expect it to become part of the email html body.
    Question one with options to choose from belowOption One.Option Two. Question two with options to choose from belowOption One.
    Option Two.
    That doesn't look like a description list at all.

    Please use code tags (# button on posting toolbar) to maintain code indentation and readability.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Import HTML code fragments to Access
    By NejcZ in forum Access
    Replies: 10
    Last Post: 08-11-2014, 07:32 AM
  2. Replies: 6
    Last Post: 03-26-2014, 10:04 AM
  3. Inserting HTML Code
    By warrenk in forum Queries
    Replies: 1
    Last Post: 06-13-2013, 04:47 PM
  4. Add javascript and html code in form
    By ashu.doc in forum Forms
    Replies: 11
    Last Post: 09-06-2012, 05:20 AM
  5. Replies: 1
    Last Post: 09-05-2012, 07:04 AM

Tags for this Thread

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