我在自动生成的电子邮件的句子的一部分上应用粗体字时遇到麻烦。
在我的VBA脚本中:
Public strBody As String
.HtmlBody = strBody
Dim FormulaCell As Range
Dim FormulaRange As Range
For Each FormulaCell In FormulaRange.Cells
With FormulaCell
我可以使用以下命令将整个句子加粗"< b >" & "**Text Here**" & "< /b >" &
但是似乎不可能对更复杂的句子或参考值应用相同的逻辑。
strBody = "Hello, " & vbNewLine & vbNewLine & _
"Your task : " & Cells(FormulaCell.Row, "B").Value & " with the mention: " & Cells(FormulaCell.Row, "C").Value & " is nearing its Due Date: "
我想在上面的句子中加粗的是FormulaCells的值。
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>"
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句