我在将超链接嵌入到某些文本(如this)时遇到问题.
我正在从 Excel 运行宏,该宏创建一个 Outlook 对象并对 c 列下的所有值重复。
以下内容不起作用,我该如何在此处嵌入链接?
.Body = "Click Here <https://www.google.com/>
下面的代码
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
On Error GoTo cleanup
For Each cell In Columns("B").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And _
LCase(Cells(cell.Row, "C").Value) = "yes" Then
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.SentOnBehalfOfName = "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7e0b0c1a1b1f0c1c11073e101b1b1a0d161b120e501d1113" rel="noreferrer noopener nofollow">[email protected]</a>"
.to = cell.Value
.Subject = "Subject" & Cells(cell.Row, "D").Value
.Body = "Click Here <https://www.google.com/>"
strLocation = "C:\Users\hahayouthought"
.Attachments.Add (strLocation)
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
End If
Next cell
最佳答案
尝试使用.HTMLBody
示例
.HTMLBody = "<A href=https://www.google.com/> Click Here </A>"
返回或设置表示指定项目的 HTML 正文的字符串。 HTMLBody 属性应该是 HTML 语法字符串。读/写。
返回或设置表示 Outlook 项目的明文正文的字符串。读/写。
关于excel - 添加超链接(Web)到 Outlook 电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54101164/