Please HELP -- Email hypertext in message

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have been searching the bulletin board for a week for an answer. I am creating an outlook email using Access VB. I want to be able to put in the message:

"Please click the link below to respond."

Then a hypertext link to an Access database on a server "\\myserver\shared\ . . ."

I have tried putting it into the body but it only goes as text. I have opened an email message and run a macro and do it manually trying to replicate the code in Access but I'm not setting something up correctly. Has anyone done this?

Thanks you for your help.
 
Hi,

You don't say what technique you're using to create the email, but AFAIK
you'll have to do it by creating an HTML message. I've never tried this,
but I think that one way is to write code that assembles the HTML code
for the message into a string and then automates Outlook (via MAPI?) to
create and send the messsage. http://www.slipstick.com is a good place
to start looking for Outlook information.

Alternatively you can use VBA to drive the HTML editor at
http://www.lebans.com/htmleditor.htm to create the HTML code for the
message.
 
John,

Thank you for responding. I will try the sites you have suggested. Below is what I am trying to do:

Function EmailSample()
Dim objOutlook As New Outlook.Application
Dim objOLJournal As Outlook.MAPIFolder
Dim objNamespace As Outlook.NameSpace
Dim objMsg As Outlook.MailItem
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objOLJournal = objNamespace.GetDefaultFolder(olFolderOutbox)
Set objMsg = objOLJournal.Items.Add(olMailItem)
objMsg.To = "(e-mail address removed)"
objMsg.Subject = "My Subject"
objMsg.Body = "Please click the link below and update your information"
' then I want to insert a link that will open an Access database on a network server
objMsg.Save
objMsg.Display
End Function

Again, thanks for your help.
 
At a minimum you'll need to replace the "Please click..." string with an
<HTML ...> ... </HTML> string containing the text and the link and the
necessary tags. You may also need to do something else to ensure that
objMsg is (a) recognised as HTML by email clients that understant HTML
and (b) has an alternate text for email clients that don't understand
HTML.

If you have Outlook Express installed somewhere you can right-click on a
message in the Inbox and select Properties, Details, Message Source...
to see how the body of an HTML message is put together.
 
John Nurick said:
At a minimum you'll need to replace the "Please click..." string with
an <HTML ...> ... </HTML> string containing the text and the link and
the
necessary tags. You may also need to do something else to ensure that
objMsg is (a) recognised as HTML by email clients that understant HTML
and (b) has an alternate text for email clients that don't understand
HTML.

I haven't actualy done this, but I think you must set the MailItem
object's HTMLBody property instead of its Body property. So instead of

objMsg.Body = "Please click the link below and update your
information"

you'd write something like this (HTML adapted from an Outlook Express
message I just created):

objMsg.HTMLBody = _
"<HTML><HEAD></HEAD>" & vbCrLf & _
"<BODY bgColor=#ffffff>" & _
"<FONT face=""Times New Roman"" size=3>" & vbCrLf & _
"Please click the link below to respond.<BR><BR>" & vbCrLf & _
"&nbsp;&nbsp;&nbsp; " & _
"<A href=""file://\\myserver\shared\"">\\myserver\shared\</A> .
.. ." & _
"</FONT>" & _
"</BODY></HTML>"
 
Back
Top