IncludeText and Emails

  • Thread starter Gary via OfficeKB.com
  • Start date
G

Gary via OfficeKB.com

Hi,

I have a VB program that we use to send emails to customers. We use a
letter_name field in the database which is used in a IncludeText field to
get the appropriate letter. I need to be able to trap the "Error! Not a
valid filename." error and stop the merge if the IncludeText field can not
find the filename. Any suggestions?

Thanks

Gary
 
P

Peter Jamieson

Assuming you are using Word 2002 or later, you will probably need to use
Word's MailMerge events, specifically the MailMergeBeforeRecordMerge event,
to inspect the value of the field before merging it.

The only other suggestion I can make is that your VB program could do a
preliminary pass through the data to construct and validate all the file
names before actually starting the merge.

Peter Jamieson
 
G

Gary via OfficeKB.com

Thanks Peter,

I guess the best thing to do would be to use the VB to do a preliminary
pass on the data to verify if the files exists. I'm not sure if the
MailMergeBeforeRecordMerge event could be use to abort the merge, since it
only occurs after the MailMerge.execute has already been issued.

Gary
 
P

Peter Jamieson

I guess the best thing to do would be to use the VB to do a preliminary
pass on the data to verify if the files exists.

It's the approach I'd probably take.
I'm not sure if the
MailMergeBeforeRecordMerge event could be use to abort the merge,

Yes,probably best avoided, but it depends partly on whether you wanted to
try to cancel all the e-mails you had already merged (in which case you're
too late if you use this approach) or simply stop merging when you encounter
a missing file, in which case what you need to do is set a variable that you
test at the beginning of the MailMergeBeforeRecordMerge to cancel the merge
for that record, and as necessary at the beginning of
MailMergeAfterRecordMerge and MailMergeAfterMerge. There may be a better way
but that one has worked for me.

Peter Jamieson.
 

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