Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to write a hyperlink in RichTextFormat with VBA? 1

Status
Not open for further replies.

ToonJ

Programmer
Sep 23, 2010
2
BJ
Hello,

I have a form with:
- e-mail adress
- subject (text)
- reference (hyperlink to a pdf document on the server)

Now I have a VBA code who allows me to open an e-mail in outlook2007, with the e-mail adress, the subject and in the body the hyperlink:

Code:
Dim link As Variant
link = (Split(Me.Reference, "#"))
mylink = "<a href='" & link(1) & "'>" & link(0) & "</a>"
'I split the link, so I only have the actually link to work with
 
Dim mess_body As String
        Dim appOutLook As Outlook.Application
        Dim MailOutLook As Outlook.MailItem
        Set appOutLook = CreateObject("Outlook.Application")
        Set MailOutLook = appOutLook.CreateItem(olMailItem)
 
        Set appOutLook = CreateObject("Outlook.Application")
        Set MailOutLook = appOutLook.CreateItem(olMailItem)
            With MailOutLook
            .BodyFormat = olFormatRichText
            .To = Me.email
            .Subject = Me.subject
            .Body = mylink

PROBLEM:

In the body of my e-mail appears for example:

P:\Representation\document2000.pdf

I can't click on the link in my e-mail, I can copy and paste it into a browser and it will open there.
Does anyone has a tip to make it possible to click on the link in outlook2007?

Thanks
ToonJ
 
try:
[red]file://[/red]p:/representation/document2000.pdf

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top