我在MS Outlook中为电子邮件创建了一个宏。用户输入问题的答案,该问题导致将该数据存储为字符串的变量。然后在HTML中生成一封电子邮件,其中包含包含该变量的超链接。我似乎无法弄清楚如何将变量“strTrackingNumber”连接到完整的超链接。有什么建议吗?
Option Explicit
Sub TestFile
Dim strTrackingNumber as String
strTrackingNumber = InputBox("Please input the Tracking Number")
Set objMsg = Application.CreateItem(olMailItem)
With objMsg
.To = "mickey.smith@surfer.com"
.CC = ""
.BCC = ""
.Subject = "Forecast"
.Categories = ""
.BodyFormat = olFormatHTML ' send HTML message
.HTMLBody = "<style> body{color:black;font-family:Arial;font-size: 12pt;}" & _
"<HTML><body>Dear Member,<br><br> The following document is ready for your review."<a href= 'http://www.bluewave.com/' & strTrackingNumber>Tracking & strTrackingNumber.</a></body>
.Display
End With
Set objMsg = Nothing
End Sub
输出链接应如下所示:http://www.bluewave.com/Tracking数字 例如http://www.bluewave.com/RA-15-30922
答案 0 :(得分:2)
.HTMLBody = "<style> body{color:black;font-family:Arial;font-size: 12pt;} </style>" & _
"<HTML><body>Dear Member,<br><br> " & _
"The following document is ready for your review. " & _
"<a href= 'http://www.bluewave.com/" & strTrackingNumber & "'>Tracking " & _
strTrackingNumber & ".</a></body>"