Hyperlink in Email

G

Graham Milner

I have used the Outlook.Application / Outlook.MailItem set in a procedure
which enables my users to send an email message to a list of colleagues by
clicking a button on a form.

how do I build a hyperlink into the text content of Outlook.MailItem.body?

Many thanks

Mill
 
S

Steven Burn

try the following;

"<a href=" & chr(34) & http://somedomain.com & chr(34) & ">sometext</a>"

Personally I just use the ShellExecute API to do things like this as it
saves messing around with strings. But I'm not sure if Access supports those
(I'm used to working with VB)

--
Regards

Steven Burn
Ur I.T. Mate Group CEO
www.it-mate.co.uk
 
G

Graham Milner

Thanks again Steven. - I tried the CHR(34) approach before my last post
with the same result. :(

Mill
 
S

Steven Burn

If you look at the Source box in an e-mail, you'll notice, it is formatted
in plain HTML (same code I gave you earlier).

Is there any possibility you could post a sample of the code you are using
to e-mail? (including the code you use to export the body text itself and if
possible, some of the body text?).

--
Regards

Steven Burn
Ur I.T. Mate Group CEO
www.it-mate.co.uk
 
G

Graham Milner

As requested.... here's the code.
thanks
Mill


Sub SendMessage()
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient

'Dim rec As Recordset
'Dim rec1 As Recordset


' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
' Add the To recipient(s) to the message.
' (I will iterate through a recordset here to add email
' addresses from my Users Table)
Set objOutlookRecip = .Recipients.Add("email address here")
objOutlookRecip.Type = olTo

' Set the Subject, Body, and Importance of the message.
.Subject = "Note from HESA Tracker"
.Body = "For info:" & vbCrLf & vbCrLf
.Body = .Body & "Please note that . . . .etc."
.Body = .Body & vbCrLf & vbCrLf & "Thanks"
.Body = .Body & vbCrLf & vbCrLf

'********************************
'code to Add hyperlink...
.Body = .Body '& . . .

'********************************


' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send

End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub
 
S

Steven Burn

I think I've got it. I've just remembered. When inserting a hyperlink into
an e-mail, you just type the URL and Outlook does the code for you?, so in
theory, you should be able to use.

'********************************
'code to Add hyperlink...
.Body = .Body & http://www.whateverurl.com
'********************************

I'm not sure if you've already tried that, but from everything I've just
read in the Access help files (Access 2000), it's pretty much that simple.
If not, I'm at a loss (and think I'll stick to API's ;o))

--
Regards

Steven Burn
Ur I.T. Mate Group CEO
www.it-mate.co.uk
 

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