Set font color in VBA for email containing form data

Brass Contributor

I have a user form to input data into a table which auto-generates an email that also contains the user form data. I would like to change the color of the data that comes from the user form in the email. I can find many places to show me how to change color of text strings, but these do not seem to work when applied to the objects. Here is my email code:

 

Dim xOutApp As Object
    Dim xOutMail As Object
    Dim xMailBody As String
    On Error Resume Next
    Set xOutApp = CreateObject("Outlook.Application")
    Set xOutMail = xOutApp.CreateItem(0)
    xMailBody = "A new Architectural Work Order has been created" & vbNewLine & vbNewLine & _
              "Please see attached and review the Architectural Work Order Workbook to note the new work requested." & vbNewLine & vbNewLine & _
              "Date Reguested: " & Me.txtDateRequested.Value & vbNewLine & _
              "Name: " & Me.txtName.Value & vbNewLine & _
              "Job Type: " & Me.cbJobType.Value & vbNewLine & _
              "Priority: " & Me.cbPriority.Value & vbNewLine & _
              "Plan Number: " & Me.txtPlanNumber.Value & vbNewLine & _
              "Plan Name: " & Me.txtPlanName.Value & vbNewLine & _
              "Elevations: " & Me.txtElevations.Value & vbNewLine & _
              "File Path: " & Me.txtFilePath.Value & vbNewLine & _
              "Strucural Options: " & Me.txtStructuralOptions.Value & vbNewLine & _
              "Community: " & Me.txtCommunity.Value & vbNewLine & _
              "Address: " & Me.txtAddress.Value & vbNewLine & _
              "Lot: " & Me.txtLot.Value & vbNewLine & _
              "Block: " & Me.txtBlock.Value & vbNewLine & _
              "Work Description: " & Me.txtDescription.Value & vbNewLine & vbNewLine
                  On Error Resume Next
    With xOutMail
        .To = "email address removed for privacy reasons"
        .CC = ""
        .BCC = ""
        .Subject = "New Architectural Work Order Submitted"
        .Body = xMailBody
        .Display   'or use .Send
    End With
    On Error GoTo 0
    Set xOutMail = Nothing
    Set xOutApp = Nothing

 

I need to find a way to change the colors for items like Me.txtDateRequested.Value and the others.

 

0 Replies