Roz_sxo
Roz_sxo

Reputation: 1

Put Hyperlink inside VBA Code for automatic emails

I created a VBA Code inwhic it autmatically sends an email. In that email, I would like to have a hyperlink which links to a webpage where I uploaded a file.

The trouble I am having is putitng the HTML Hyperlink tags inside the VBA Code.

Check out my code:

msgbody = "Hi Everyone" & "<br> <br>" _
& "I have attached the excel file to this afternoon's Open Order Report above, as well as provided the link below:" & "<br> <br>" _
& "Please reach out if you have any more questions or concerns" & "<br>"
& "<a href= & "www.google.com">" & "link" </a>"

With objemail
    .to = "[email protected]"
    .cc = ""
    .Subject = "test"
    .htmlbody = msgbody
    .display
End With

End Sub

Upvotes: 0

Views: 494

Answers (1)

Matteo NNZ
Matteo NNZ

Reputation: 12645

Replace this:

& "<a href= & "www.google.com">" & "link" </a>"

with this

& "<a href=" & """" & "www.google.com" & """" & ">" & "link" </a>"

Upvotes: 2

Related Questions