I'm trying to add a hyperlink to an email, but keep getting a Run Time Error 91. Object variable or With block variable not set. Here is the code...
Dim MsgBody As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Dim Hyp As Hyperlink
Hyp = "http://Y:\Purchasing.accdb"
MsgBody = "Please approve the Purchase Request located at " & Hyp & " from " & Me.txtLUEmpName & "." & "<br>" & "Thank you."
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatRichText
.To = Me.txtEmpM
.Subject = "Please Approve Purchase Request"
.HTMLBody = MsgBody
'.DeleteAfterSubmit = True 'This would let Outlook send the note without storing it in your sent bin
.Display
End With
The Hyp =... line is what is highlighted with the error. I have typed the address to the database, as well as copied & pasted, but keep getting this error. Any ideas while still using this format as opposed to learning the HTML version?