首页 > 解决方案 > Add file link to email body VBA

问题描述

I'd like to add a network file link to my email body using Excel VBA.

The code below add the text, but I'd like file location to be a hyperlink?

 strbody_2 = "<BODY style=font-size:11pt;font-family:Calibri><b><u>" & "CapAd File:" & "</b><u>" & "<br>" _
    & Sheets("Control").Range("CapAd_File") _  ' THIS IS THE FILE LOCATION 
    & "</b></u>"

标签: excelvba

解决方案


尝试使用 html <a>-Anchor 标签:

strbody_2 = "<BODY style=font-size:11pt;font-family:Calibri><b><u>" & "CapAd File:" & "</b><u>" & "<br>" _
    & "<a href=""" & Sheets("Control").Range("CapAd_File") & """>" _
    & Sheets("Control").Range("CapAd_File") _  ' THIS IS THE FILE LOCATION 
    & "</a></b></u>"

(对不起,如果我没有得到正确的撇号,我在发布之前没有测试它)


推荐阅读