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

时间:2015-10-03 19:04:07

标签: vba excel-vba excel

我一直在寻找一种方法来添加通过VBA发送的电子邮件的超链接。我找到了这段代码但不确定如何实现它:

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

这是我到目前为止所得到的,我想将“here”这个词转到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

1 个答案:

答案 0 :(得分:0)

您只需添加<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