繁体   English   中英

用VBA发送的电子邮件中的网站超链接

[英]Website hyperlink in email sent with VBA

我一直在寻找将超链接添加到通过VBA发送的电子邮件中的方法。 我找到了以下代码,但不确定如何实现:

Dim ws As Worksheet
    Set ws = ActiveSheet
    ws.Hyperlinks.Add [a1], "google.com", _
      , "Go to Google.", "Google"

到目前为止,这就是我想要的,我想在Google.com上输入“这里”一词:

 Sub email_tracking()

        MailFromMacwithOutlook bodycontent:="Hi " & Range("C3").Value & "<br><br>" & "Thank you for placing an order with us, your order has now been packed and dispatched. " & _
        "Please click here to track you order. " & "<br>" & " Typically orders will take between 1-2 working days to arrive. " & "<br><br>" & _
        "Carrier: Royal Mail " & " <br>" & _
        "Tracking Number: " & Range("C4").Value & " <br><br>" & _
        "If you encounter any difficulties or have any questions please email us and we will get back to you within 24 hours. " & " <br><br>" & _
        "The Logistics Team", _
                    mailsubject:="Order Dispatched (" & Range("C2").Value & ")", _
                    toaddress:="EMAIL ADDRESS HERE", _
                    ccaddress:="", _
                    bccaddress:="", _
                    attachment:="", _
                    displaymail:=False
End Sub

您可以在<a href="www.google.com">here</a>添加:

MailFromMacwithOutlook bodycontent:="Hi " & Range("C3").Value & "<br><br>" & "Thank you for placing an order with us, your order has now been packed and dispatched. " & _
        "Please click <a href=""www.google.com"">here</a> to track you order. " & "<br>" & " Typically orders will take between 1-2 working days to arrive. " & "<br><br>" & _
        "Carrier: Royal Mail " & " <br>" & _
        "Tracking Number: " & Range("C4").Value & " <br><br>" & _
        "If you encounter any difficulties or have any questions please email us and we will get back to you within 24 hours. " & " <br><br>" & _
        "The Logistics Team", _
                    mailsubject:="Order Dispatched (" & Range("C2").Value & ")", _
                    toaddress:="EMAIL ADDRESS HERE", _
                    ccaddress:="", _
                    bccaddress:="", _
                    attachment:="", _
                    displaymail:=False

暂无
暂无

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

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