簡體   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