Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将粗体应用于HTMLbody文本字符串内的单元格值_Html_Vba_Email - Fatal编程技术网

将粗体应用于HTMLbody文本字符串内的单元格值

将粗体应用于HTMLbody文本字符串内的单元格值,html,vba,email,Html,Vba,Email,对于自动生成的电子邮件,我在句子的一部分使用粗体时遇到问题 在我的VBA脚本中: Public strBody As String .HtmlBody = strBody Dim FormulaCell As Range Dim FormulaRange As Range For Each FormulaCell In FormulaRange.Cells With FormulaCell 我能用“”和“**此处文本**”和“”和 但似乎不可能对更复杂的句子或

对于自动生成的电子邮件,我在句子的一部分使用粗体时遇到问题

在我的VBA脚本中:

Public strBody     As String
.HtmlBody = strBody
Dim FormulaCell     As Range
Dim FormulaRange    As Range


For Each FormulaCell In FormulaRange.Cells
    With FormulaCell
我能用
”和“**此处文本**”和“”和

但似乎不可能对更复杂的句子或引用值应用相同的逻辑

strBody = "Hello, " & vbNewLine & vbNewLine & _
          "Your task : " & Cells(FormulaCell.Row, "B").Value & " with the mention: " & Cells(FormulaCell.Row, "C").Value & " is nearing its Due Date: "
我想在上面的句子中加粗的是公式的价值

strBody = "Hello, " & vbNewLine & vbNewLine & _
                        "Your task : " & **Cells(FormulaCell.Row, "B").Value** & " with the mention: " & **Cells(FormulaCell.Row, "C")**.Value & " is nearing its Due Date: "
因此,在我的电子邮件中看起来是这样的:

你好

您的任务:吃土豆并提到:土豆很好吃即将到期:

这是可以做到的吗?

编辑

strBody = "<p>Hello</p>, " & vbNewLine & vbNewLine & _
          "<p>Your task : <b>" & Cells(FormulaCell.Row, "B").Value & _
          "</b> with the mention: <b>" & Cells(FormulaCell.Row, "C").Value & _
          "</b> is nearing its Due Date: </p>"
strBody=“Hello

,”&vbNewLine&vbNewLine&_ 您的任务:“&Cells(FormulaCell.Row,“B”).Value&_ 提到:“&Cells(FormulaCell.Row,“C”).Value&_ “即将到期:


谢谢您抽出时间!看起来这应该是对的,尽管它在我的电子邮件中仍然没有那么粗体,而且不知怎么的,vbNewLine不再工作了。。。如果有帮助的话,将vbNewLine切换到
也不起作用。我正在使用Excel 2010和Outlook 2010。请确保您将邮件类型设置为HTML,并查看我对换行符的编辑。有些代码现在工作正常:)不确定更改了什么,但一切正常。非常感谢蒂姆。