Insert Hyperlink

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
 
T

Tim young

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
 

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