1
對於自動生成的電子郵件的句子部分應用粗體時遇到問題。將粗體應用於HTMLbody文本字符串中的單元格值
在我的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: "
所以它看起來類似的東西在我的郵箱:
你好
你的任務:吃土豆與提:土豆好吃接近其到期日期:
這是什麼可以不穿è?
感謝您的時間!它看起來應該是正確的,雖然它仍然不會在我的電子郵件中以粗體顯示,但vbNewLine不再工作了......切換vbNewLine的
也不起作用 –
我正在使用Excel 2010和Outlook 2010,如果這可以幫助。 –
確保你將郵件類型設置爲HTML,並看到我的編輯有關換行 –