View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
KC KC is offline
external usenet poster
 
Posts: 94
Default Hyperlink in body of VBA email

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

"Chadersmith" wrote:

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 = "
.CC = "
.BCC = ""
.Subject = "whatever"
.Body = strbody
.Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub