Send HTML Email from Access

C

Clint Marshall

I'm sending an HTML email from Access 2000 and trying to include a hyperlink
to a file on our server. The email will only be accessed internally, so
there's no problem with the hyperlink not working. I'm sending this through
Outlook XP.

My problem is figuring out the syntax for using a string variable as the
hyperlink.

The following code is in a VBA Module and works fine:

.HTMLBody = "<body>" _
& "<a href=""s:\marketing worksheets\children's theatre of
maine\Children's Theatre Mktg Wksht.mdb""> Children's Theatre </a>" _
& "</body>"

However, when I change to using a variable so I can use different file
names, it looks like this:

stHyperLinkFile = """" & CurrentProject.Path & "\" &
CurrentProject.Name & """"""
.HTMLBody = "<body>" _
& "<a href=stHyperLinkFile> Children's Theatre </a>" _
& "</body>"

The link shows up fine, but Outlook think's it's linking to something called
"stHyperLinkFile". In other words, it's not taking the variable as a
variable.

How can I get the HTML to take the variable as a variable or find some other
way to get this to work?

Thanks!

-Clint Marshall
 
T

Tom Collins

Clint Marshall said:
I'm sending an HTML email from Access 2000 and trying to include a hyperlink
to a file on our server. The email will only be accessed internally, so
there's no problem with the hyperlink not working. I'm sending this through
Outlook XP.

My problem is figuring out the syntax for using a string variable as the
hyperlink.

The following code is in a VBA Module and works fine:

.HTMLBody = "<body>" _
& "<a href=""s:\marketing worksheets\children's theatre of
maine\Children's Theatre Mktg Wksht.mdb""> Children's Theatre </a>" _
& "</body>"

However, when I change to using a variable so I can use different file
names, it looks like this:

stHyperLinkFile = """" & CurrentProject.Path & "\" &
CurrentProject.Name & """"""
.HTMLBody = "<body>" _
& "<a href=stHyperLinkFile> Children's Theatre </a>" _
& "</body>"

The link shows up fine, but Outlook think's it's linking to something called
"stHyperLinkFile". In other words, it's not taking the variable as a
variable.

How can I get the HTML to take the variable as a variable or find some other
way to get this to work?

Thanks!

-Clint Marshall

Try changing this line:
stHyperLinkFile = "" & CurrentProject.Path & "\" & _
CurrentProject.Name & ""


Tom Collins
 
C

Clint Marshall

Thanks, Tom!
That still didn't work (something with the quotes, I think), so I switched
to creating the whole HTML code as a variable and then pasting the variable
into .HTMLBody.

-Clint
 
Top