简体   繁体   English

将 Web 链接设置为 VBA 电子邮件中的“单词”

[英]Set a web link to a "word" in a VBA email

If this email does not display properly, please click here .如果此电子邮件无法正常显示,请单击此处

I would like to be able to have the person in the email click on the word "here" and then it will take them to a website.我希望能够让电子邮件中的人单击“此处”一词,然后将他们带到一个网站。

This is what I have bee using but it just puts the full link into the email.这是我一直在使用的,但它只是将完整链接放入电子邮件中。

mymsg = "<HTML><BODY>"
mymsg = "If this email does not display properly, please click " & "<A href=http://us.localnews.com/ov?mailing=3TVGZMLJ-WDS49&m2u=3TVGZMLK-3TVGZMLJ-12Z630I>URL Text</A>"
mymsg = mymsg & "</BODY></HYML>"

Keep it simple, no need for the HTML/BODY tags保持简单,不需要HTML/BODY标签

Example例子

Option Explicit
Public Sub Example()
    Dim OutApp As Object
    Set OutApp = CreateObject("Outlook.Application")

    Dim OutMail As Object
    Set OutMail = OutApp.CreateItem(0)

    With OutMail
        .HTMLBody = "If this email does not display properly, please click " & _
                    "<A href=https://stackoverflow.com/>" & _
                    "Here</A>"
        .Display
    End With

End Sub

Make sure you are using HTMLBody Property确保您使用的是HTMLBody属性

MSDN - HTMLBody Property MSDN - HTMLBody 属性

Returns or sets a String representing the HTML body of the specified item.返回或设置表示指定项的 HTML 正文的字符串。 The HTMLBody property should be an HTML syntax string. HTMLBody 属性应该是 HTML 语法字符串。 Read/write.读/写。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM