这可能是我想念的一件小事,但我似乎无法发现这个问题。
Sub sendemail()
'Save the form with todays date
Application.Save Format(Now, "dd-mm-yy") & ".xls"
'Create the email
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "<HTML><BODY>"
strbody = strbody & "<A href= http://ne-xxx.xxx.xxx.xxx.biz/ASP/SFP/BHGP/xxUK-OPS/Shared%20Documents/xxx/AllItems.aspx?RootFolder=%2fAxP%2fASP%2fBP%2fNUK%2dOPS%2fShared%20Documents%2f60%2e%20Shift%20Schedule&FolderCTID=&View=%7b1A03DBA9%2d7CEB%2d466F%2d8EA8%2dDDE03D95CDC0%7d>URL</A>"
strbody = strbody & "</BODY></HTML>"
On Error Resume Next
With OutMail
.To = "[xxxx@xx]"
.cc = ""
.BCC = ""
.Subject = "New Holiday Request on " & Format(Now(), "dd/mm/yyyy") & " by " & Range("C2") & ""
.Body = strbody
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Debug.Print strbody
End Sub
最终结果应该只是电子邮件中的超链接......但它显示:
http://ne-xxx.xxxx.xxx.xxxx.xxx/sSP/SXP/BJHJP/xxx-OPS/Shared%20Documents/Forms/AllItems.aspx?RootFolder=%2fASP%2fSsP%2foP%2fNBXUK% 2dOPS%2fShared%20Documents%2f60%2E%20Shift%20Schedule&安培; FolderCD =安培;查看=%7b1A03DBA9%2d7CEB%2d466F%2d8EA8%2dDDE03D95CDC0%7D&GT; URL
答案 0 :(得分:1)
请使用以下代码块
strbody = strbody & "<A href=""http://ne-xxx.xxx.xxx.xxx.biz/ASP/SFP/BHGP/xxUK-OPS/Shared%20Documents/xxx/AllItems.aspx?RootFolder=%2fAxP%2fASP%2fBP%2fNUK%2dOPS%2fShared%20Documents%2f60%2e%20Shift%20Schedule&FolderCTID=&View=%7b1A03DBA9%2d7CEB%2d466F%2d8EA8%2dDDE03D95CDC0%7d"">URL</A>"
.HTMLBody = strbody instead of Body
答案 1 :(得分:0)
更改
.Body = strbody
到
.HTMLBody = strbody
我的示例vbs代码使用或不使用引号
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "<HTML><BODY>"
strbody = strbody & "<A href=http://ne-xxx.xxx.xxx.xxx.biz/ASP/SFP/BHGP/xxUK-OPS/Shared%20Documents/xxx/AllItems.aspx?RootFolder=%2fAxP%2fASP%2fBP%2fNUK%2dOPS%2fShared%20Documents%2f60%2e%20Shift%20Schedule&FolderCTID=&View=%7b1A03DBA9%2d7CEB%2d466F%2d8EA8%2dDDE03D95CDC0%7d>URL</A>"
strbody = strbody & "</BODY></HTML>"
With OutMail
.To = "pankaj.jaju@stackoverflow.com"
.HTMLBody = strbody
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing