如何在VBA邮件编程中突出显示粗体样式的整数值

时间:2017-05-29 11:54:49

标签: vba excel-vba excel

受尊敬的专家,我只想在我的VBA邮件编程中突出显示粗体样式的整数值。

请查找我的以下代码:

    Dim FTD_Target As Integer

      FTD_Target = Round(Cells(49, 5), 2) ''--I want this value should be highlighted in Bold in .HTMLBody

    Dim rng As Range
        Dim OutApp As Object
        Dim OutMail As Object
        Dim strbody As String

        With Application
            .EnableEvents = False
            .ScreenUpdating = False
        End With

        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(0)

     With OutMail
        .Display
        End With
            Signature = OutMail.HTMLBody
        On Error Resume Next
        With OutMail
            .To = "mail id"
            .CC = ""
            .BCC = ""
            .Subject = "This is the Subject line"
            .HTMLBody = "Hi," & "<br>" & "Please find the Daily Target:-" & 
FTD_Target

    End With

请指导相同的内容。

1 个答案:

答案 0 :(得分:1)

快速而肮脏的解决方案:

    .HTMLBody = "Hi," & "<br>" & "Please find the Daily Target:-" & "<b>" & 
FTD_Target & "</b>"

最佳解决方案:

 .HTMLBody = "Hi," & "<br>" & "Please find the Daily Target:-" & "<div style='font-weight: bold;'>" & FTD_Target & "</div>"