I am trying to generate emails from excel but want to add hyperlinks to the email body text. I want the hyperlinks to show as text and not the file paths.
How would I go about doing this?
I am using the below code.
strBody = "Hello " & Range("QuoteFirstName").Value & "," & _
vbNewLine & _
vbNewLine & _
"It was good to speak with you earlier today/yesterday." & _
vbNewLine & _
vbNewLine & _
"[Any personal message]" & _
vbNewLine & _
vbNewLine
On Error Resume Next
With OutMail
.To = StrTo
.CC = ""
.BCC = ""
.Subject = StrSubject
.Body = StrBody
.Attachments.Add FileNamePDF
If Send = True Then
.Send
Else
.Display
End If
End With
Can I use .Hyperlinks.Add
?
Presuming your using outlook automation, switch to the HTML mail format:
.BodyFormat = olFormatHTML '// 2
.HTMLBody = strBody
And use markup for the body:
strBody = "Hello ..<br />next line ..." & _
"Click <a href=""http://www.foo.com"">here</a> to ..."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With