+ Reply to Thread
Results 1 to 12 of 12

Change Font formatting mid-sentence of HTMLBody Outlook mail

Hybrid View

  1. #1
    Registered User
    Join Date
    07-16-2014
    Location
    Washington
    MS-Off Ver
    2010
    Posts
    37

    Re: Change Font formatting mid-sentence of HTMLBody Outlook mail

    Quote Originally Posted by Domenic View Post
    Try replacing...

    .HTMLBody = "<HTML><BODY><H2><I><P Style='font-family:Arial;font-size:18pt;color:red'>Example <Change font color HERE>Text #1</CHANGE></I></H2></P>"
    with

    .htmlbody = "<HTML><BODY><H2><I><P Style='font-family:Arial;font-size:18pt;color:red'>Example <span style=""color:rgb(31,73,125);"">Text #1</span></P></I></H2>"
    That did the trick! Here's my final code. Now I've got to find a way to add some space between the table columns. I'd think by now I owe someone a lunch!!!
        .HTMLBody = "<HTML><BODY><H2><I><P Style='font-family:Arial;font-size:18pt;color:red'>New Alert"
        .HTMLBody = .HTMLBody & "<Span Style=""Color:RGB(31,73,125);"">TextColor2-On-Same-Line!!!!</SPAN></P></I></H2>"
        .HTMLBody = .HTMLBody & "<TABLE><TR><TD><B>Incident Report Detail:</TD></B><a href=""" & MyLink & _
            TextBox1.Value & """>" & TextBox1.Value & "</a>" & _
            "<TR><TD><B>Status:</TD></TR></B>" & ComboBox1.Text & _
            "<TR><TD><B>Date/Time Reported:</TD></TR></B>" & TextBox2.Text & _
            "<TR><TD><B>Impact Summary:</TD></TR></B>" & TextBox3.Text & _
            "<TR><TD><B>Locations Impacted:</TD></TR></B>" & TextBox4.Text & _
            "<TR><TD><B>Incident Manager:</TD></TR></B>" & TextBox5.Text & _
            "<TR><TD><B>Actions / Progress:</TD></TR></B>" & TextBox6.Text & _
            "<TR><TD><B>Root Cause:</TD></TR></B>" & TextBox7.Text & _
            "</TABLE></BODY></HTML>"
        .Importance = 2

  2. #2
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Change Font formatting mid-sentence of HTMLBody Outlook mail

    It doesn't look that your code actually creates a table consisting of two columns, which is what I think you want. Try to adopt the following code, which creates a table consisting of 2 rows and 2 columns...

    .HTMLBody = "<table style=""text-align: left;"" border=""0""" & _
                 "cellpadding=""2"" cellspacing=""2"">" & _
                  "<tbody>" & _
                    "<tr>" & _
                      "<td style=""font-weight: bold; width: 300px;"">Incident Report Detail:</td>" & _
                      "<td style=""width: 300px;""><a href=""www.google.com"">MyLink</a></td>" & _
                    "</tr>" & _
                    "<tr>" & _
                      "<td><span style=""font-weight: bold;"">Status:</span></td>" & _
                      "<td>Text here...</td>" & _
                    "</tr>" & _
                  "</tbody>" & _
                "</table>"
    Notice that the each <tr>...</tr> refers to one row, and each <td>...</td> refers to one column. Adjust the widths for each column, accordingly. And, you may want to adjust the cellpading and cellspacing.

    Hope this helps!

  3. #3
    Registered User
    Join Date
    07-16-2014
    Location
    Washington
    MS-Off Ver
    2010
    Posts
    37

    Re: Change Font formatting mid-sentence of HTMLBody Outlook mail

    Thank you Domenic, working on this now. Is there a tag to allow a table cell to word wrap? Or would that happen on its own?

  4. #4
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Change Font formatting mid-sentence of HTMLBody Outlook mail

    Unless otherwise specified, I think it would happen on it's own...

  5. #5
    Registered User
    Join Date
    07-16-2014
    Location
    Washington
    MS-Off Ver
    2010
    Posts
    37

    Re: Change Font formatting mid-sentence of HTMLBody Outlook mail

    Cool beans, I could use a break! I'm slowly adding your new table layout into the VBA and its working.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Change font size of text in mail VBA code
    By ExcelFailure in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-05-2013, 12:51 PM
  2. Change of formatting in a sentence to subscript
    By Sc0tt1e in forum Word Programming / VBA / Macros
    Replies: 0
    Last Post: 06-28-2013, 05:50 AM
  3. Change of formatting in a sentence to subscript
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-28-2013, 05:50 AM
  4. change e-mail font default color
    By mvan in forum Excel General
    Replies: 1
    Last Post: 04-04-2006, 06:35 PM
  5. [SOLVED] outlook htmlbody
    By Erin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-06-2005, 03:06 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1