I feel like giving up. I just can't figure this out or find clear examples that can apply to my VBA. Everything works with a basic message, just not when I try to hyper-link the body of the message. If you could provide any help or know how to simply solve this issue, I would be sooo grateful.
The issue: I am attempting to Hyper-link a particular email address, for arguments sake, john@email.com within the body of the Email Message as seen below and hyper-link the email address to the words "contact us." Furthermore, I am attempting to hyper-link a web address to the words "Lean Website" and a different one for "White Belt Report."
You can see in the following lines that I've included 'with hyperlink url to > to the word or email I would really love to be hyperlinked, for explanation purposes only. If you could delete them, and leave only the hyperlinked word that would be great.
Sub Test2()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
On Error GoTo cleanup
For Each cell In Range("Q1:Q" & Cells(Rows.Count, "Q").End(xlUp).Row)
If cell.Value Like "?*@?*.?*" And _
LCase(Cells(cell.Row, "R").Value) = "yes" _
And LCase(Cells(cell.Row, "S").Value) <> "sent" Then
Set OutMail = OutApp.CreateItem(0)
strbody = "Hello " & Cells(cell.Row, "P").Value & "<br>" _
& "<br>" _
& "Line 1" & "<br>" _
& "<br>" _
& "Line 2" & "<br>" _
& "<br>" _
& "Line 4 'with hyperlink url to > Lean Website" & "<br>" _
& "<br>" _
& "Line 5" & "<br>" _
& "<br>" _
& "Line 6" & "<br>" _
& "<br>" _
& "Steps:" & "<br>" _
& " 1. Document your report using the 'with hyperlink url to > White Belt Report" & "<br>" _
& "" & "<br>" _
& " 2. Review with supervisor" & "<br>" _
& "" & "<br>" _
& " 3. Forward your White Belt Report to and any questions 'with hyperlink to email > john@email.com & " < br > "" _
& "" & "<br>" _
& "If you need any assistance, feel free to 'with hyperlink to email john@email.com > contact us"
On Error Resume Next
With OutMail
.To = cell.Value
.CC = ""
.BCC = ""
.Subject = "Report Reminder"
.HTMLBody = strbody
.Display
End With
On Error GoTo 0
Cells(cell.Row, "S").Value = "sent"
Set OutMail = Nothing
End If
Next cell
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
Thanks for taking the time to even read my issue, I just am not skilled enough for this.
Bookmarks