HTML超链接在文件路径中的空格处停止



通过我编写的VBA代码发送电子邮件时,在电子邮件正文中发送的文件路径停止在第一个空格处。我相信我的报价是对的,但还是不够。

此外,有人知道快速修复程序吗?它包括发送电子邮件的用户的签名?

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("M").Cells.SpecialCells(xlCellTypeConstants)
If LCase(Cells(cell.Row, "M").Value) = "no" Then
Set OutMail = OutApp.CreateItem(0)
strbody = "Dear " & Cells(cell.Row, "A").Value _
& "<br>" & "<br>" & _
"You still have outstanding work on the Rescan Spreadsheet " & _
" Title number:  " & Cells(cell.Row, "E").Value _
& "<br>" & "<br>" _
& "<A href=" & "\cv-vfl-d01dlr_officeOperational TeamsRR Scanning TeamBack file QA XeroxDocument RescansRescans 2019" & ">Click here to open file location</A>"

On Error Resume Next
With OutMail
.To = Cells(cell.Row, "B").Value
.CC = "Bethany.Turner@Landregistry.Gov.uk"
.Subject = "Re-Scan Reminder"
.HTMLbody = strbody
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
End If
Next cell
Cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
MsgBox "Reminder Sent", vbOKOnly   
End Sub

消息显示后,当您单击超链接时,它会停止并提供一条错误消息,说明无法找到\cv-vfl-d01dlr_officeOperational

您不需要在href=和文件名之间使用与号,但您确实需要添加一个额外的双引号:

"<A href=""\cv-vfl-d01dlr_officeOperational TeamsRR Scanning Team" & _
"Back file QA XeroxDocument RescansRescans 2019"">Click here to open file location</A>"

HTML要求url在链接周围有引号。如果这是HTML中的一个正常字符串,它看起来像:

<a href="\my file path">My link name</a>

或者,如果对您有帮助,您可以使用Chr()函数在字符串中放置双引号字符:

"<A href=" & Chr$(34) & "\cv-vfl-d01dlr_office...

最新更新