Send HTML Email from Access

  • Thread starter Thread starter Clint Marshall
  • Start date Start date
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
 
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
 
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
 

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

Back
Top