Adding a hyperlink to a macro generated e-mail

G

GDCobra

I am using the following code to send an e-mail from a macro within Excel.
This works but the purpose of the e-mail it to indicate to the recipient a
file which needs to be examined. I would like the filename to appear as a
hyperlink so that when the e-mail is received the name can be clicked on to
open the required file. Can anyone suggest a modification to the code which
would write a hyperlink to the piece of text on the mail?
Any help greatly appreciated.

Public Sub eMailReiterReq()
Dim strbody As String
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String


Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

'Messeage content for e-mail
strbody = "Equipment has failed its check and requires attention." &
vbNewLine & _
"Results Spreadsheet located at:-" & vbNewLine & _
"" & vbNewLine & _
"D:\myfilespathstructure\myimportantfilename.xls '<<<<<
This is required to be a hyperlink to go direct to the file.


On Error Resume Next
With OutMail
.To = "(e-mail address removed)"
.CC = ""
.BCC = ""
.Subject = strsub
.Body = strbody
.Display
'Application.Wait (Now + TimeValue("0:00:00")) '- Uncomment these
lines to auto send after timer time out.
'Application.SendKeys "%S"
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing



End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top