Email using Template

J

Jack G

I'm trying to send email from Access either by using vba's SendObject or
with the Send Macro. I want the email to pick up the message portion of the
email from a Template that can then be edited by the user, but it doesn't
seem to work. The vba looks something like this:

DoCmd.SendObject acSendNoObject, , , strRecipient, strCopy, , strSubject, ,
True, "C:/TestEmail.oft".

It starts up an email OK, but there's no content in the message portion.

I also tried composing the message string in vba, but the message doesn't
want to accept very long strings (not to mention that it's very awkward to
write the message this way).

Am I missing something?

Jack
 
R

Rick Brandt

Jack said:
I'm trying to send email from Access either by using vba's SendObject
or with the Send Macro. I want the email to pick up the message
portion of the email from a Template that can then be edited by the
user, but it doesn't seem to work. The vba looks something like this:

DoCmd.SendObject acSendNoObject, , , strRecipient, strCopy, ,
strSubject, , True, "C:/TestEmail.oft".

It starts up an email OK, but there's no content in the message
portion.
I also tried composing the message string in vba, but the message
doesn't want to accept very long strings (not to mention that it's
very awkward to write the message this way).

Am I missing something?

Jack

You are misunderstanding what the "template file" argument is for. If you
want canned text in the message body then you need to use the message
argument (the one after subject). I would suggest putting your canned text
into a VBA constant or storing it in a table to make it easy to retrieve and
insert into your current code.
 
J

Jack G

Thanks Rick and Doug,

Rick - putting the string in a table is going to work well for me - it means
I (or a user) can revise the string from time to time without going into the
code. I think I'll put the To, Copy, and Subject strings in the table, too,
to make them more accessible.

Doug - my next question was going to be what do I do about the error
messages I get when someone cancels out of the email -- this answers it,
thanks.

Jack
 

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