Change font & color of 1 line of email generated from VBA RRS feed

  • Question

  • I'm quite a newbie to VBA and I've searched but haven't found something I can get to work, probably just my own incompetence. I'm trying to change font and color of just one line of the code below, not the entire body of the email text. I want "ORDER WILL NOT BE RELEASED FOR SHIPMENT UNTIL THIS INFORMATION IS RECEIVED." & vbCrLf & vbCrLf & _ to be in bold red lettering. Thank you for any assistance.

        strBody = ServiceTicketNewFirstName.value & "," & vbCrLf & vbCrLf & _
                                "I have received a copy of your order for a new phone.  I will be working with you to configure the phone and provide tracking information.  I have a few questions that I need to ask so that I can have everything ready when your phone arrives." & vbCrLf & _
                                "If there are multiple phones on this order I will need to have these questions answered for each phone that you would like programmed." & vbCrLf & vbCrLf & _
                                "Employee Move or New Hire:" & vbCrLf & _
                                "           - Is the phone order for a new employee or is this order for an existing employee that is moving?" & vbCrLf & _
                                "           - If this is a move of an existing employee, please provide the mac address of the existing phone." & vbCrLf & _
                                "           - Then I need existing location and new location for user." & vbCrLf & vbCrLf & _
                                "Call Center Users" & vbCrLf & _
                                "           - Do you login to use your phone?" & vbCrLf & _
                                "             There will be additional information needed if the answer is yes to this question." & vbCrLf & vbCrLf & _
                                "Voice Recording" & vbCrLf & _
                                "           Do you need to have your phone recorded?  If so please follow the instructions below." & vbCrLf & _
                                "           - Once your new phone has been installed and tested please go the following website and place your request for Voice Recording." & vbCrLf & _
                                "     please click on Submit Voice Recording Request and complete the questions." & vbCrLf & _
                                "              This site will create a Remedy and route the ticket to the telecom team to complete the work." & vbCrLf & vbCrLf & _
                                "Basic phone configuration" & vbCrLf & _
                                "           - What will the display name on the phone need to be?" & vbCrLf & _
                                "           - Will you need a new number for the phone or will this be an existing number?  If this is a new number does it need to be a direct number or an internal extension?" & vbCrLf & _
                                "           - Will you need voicemail?" & vbCrLf & _
                                "           - If voicemail is needed I will need the SCid of the user needing voicemail." & vbCrLf & _
                                "           - Will you need any speed dial's configured?  If you have ordered anything but a 7911 you will have at least one additional line that could be configured?" & vbCrLf & vbCrLf & _
                                "I will be receiving tracking information and the mac address of the phone once the order is complete.  Once I receive this information I will pass it along and make sure that you receive the new phone and that it is configured and working properly." & vbCrLf & vbCrLf

    Monday, October 6, 2014 4:40 PM


  • The formatting can't be done the standard Body of the Outlook Object.

    You have to use the HMTLBody property instead to change formatting of text.

    See below example:

    Dim olApp As Object
    Dim emItem As Object
    Dim Msg As String
    Dim strMore As String
       On Error Resume Next
        Set olApp = GetObject(, "Outlook.Application")
        If Err.Number = 429 Then
            Set olApp = CreateObject("Outlook.application")
        End If
        On Error GoTo 0
    Set emItem = olApp.CreateItem(0)
    strMore = "That all I have for now!"
    'define and code the HTML message
    Msg = Msg & "<p><font face=""Comic Sans MS"" size=""3"" color=""red""><b>Please let me know if you have any questions.</b></font></p><p></p>"
    Msg = Msg & "<p><font face=""Times New Roman"" size=""2"" color=""blue""><i>Thanks and enjoy coding!</i></font></p>"
    Msg = Msg & "<p><font face=""Arial"" size=""1"" color=""green""><u>" & strMore & "</u></font></p>"
    With emItem
    .To = ""
    .HTMLBOdy = Msg
    End With
    Set emItem = Nothing
    Set appOut = Nothing

    Hope this helps,

    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"

    Please vote an answer helpful if they helped. Please mark an answer(s) as an answer when your question is being answered.

    Monday, October 6, 2014 5:37 PM