Insert Hyperlink

  • Thread starter Thread starter Vyyk Drago
  • Start date Start date
V

Vyyk Drago

Hi,

How does one insert a hyperlink into the body of an email
programmatically. Especially, how do I deal with
hyperlinks to file locations on a local network - I find
that hyperlinks with spaces in file/folder names tend to
break down sometimes. Any nudges in the right direction
will be GREATLY appreciated.

Many thanks and kind regards
Vyyk
 
Hi Vyyk,

Assuming you are using HTML format email bodies, you can
write the HTML to the email...here is a silly little
sample below that I am currenlty using to learn more
myself. Maybe if someone knows a better way, they can
post it later.

Option Explicit

Sub OrangeCatHyperlinks()

Dim olApp As Outlook.Application
Dim olNameSpace As Outlook.NameSpace
Dim olMailItem As Outlook.MailItem

Dim theName As String

theName = "c:\my files\orange cat.xls"

Set olApp = Outlook.Application
Set olNameSpace = olApp.GetNamespace("MAPI")
Set olMailItem = olApp.CreateItem
(Outlook.OlItemType.olMailItem)

With olMailItem
.Display
.Body = "This is the body...it contains and Orange
Cat"
.HTMLBody = "<A HREF=" & Chr(34) & "file:///" &
theName & Chr(34) & ">" & theName & "</A>" & Chr(13)
& .HTMLBody

End With

End Sub


Hope this helps to get you going...
Kind regards
Tim and the Orange Cat
 
Back
Top