Hyperlink in body of VBA email

C

Chadersmith

Hi Guys,

I'm fairly new to VBA so this should be an easy fix. I am trying to include
a network link in the body of an email that is being generated in VBA.

I specifically want to make \\server\file a direct link or hyperlink to a
specific network location. I can't seem to figure out how to do it.

Thanks for your help.

Below is the code:

Sub EmailEE()
'
'Working in Office 2000-2007
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)

strbody = "body of email" & vbNewLine & vbNewLine & _
"\\server\folder" & vbNewLine & vbNewLine & _
"Thank You," & vbNewLine & _
"Me"

On Error Resume Next
With OutMail
..To = "(e-mail address removed)"
..CC = "(e-mail address removed)"
..BCC = ""
..Subject = "whatever"
..Body = strbody
..Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub
 
K

KC

use
OutMail.htmlbody = strbody
instead of
OutMail.Body=strbody

and include hyperlink in strbody

strbody= "body of email" & vbNewLine & vbNewLine & "<a
href=""\\server\folder"">\\server\folder</a>" & vbNewLine & vbNewLine &
"Thank You," & vbNewLine & "Me"

-kc
*Click YES if this helps
 

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