Reply
 
Thread Tools Display Modes
  #1   Report Post  
Gary via OfficeKB.com
 
Posts: n/a
Default IncludeText and Emails

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

--
Message posted via http://www.officekb.com
  #2   Report Post  
Peter Jamieson
 
Posts: n/a
Default

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

"Gary via OfficeKB.com" wrote in message
...
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

--
Message posted via http://www.officekb.com



  #3   Report Post  
Gary via OfficeKB.com
 
Posts: n/a
Default

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

--
Message posted via http://www.officekb.com
  #4   Report Post  
Peter Jamieson
 
Posts: n/a
Default

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.

"Gary via OfficeKB.com" wrote in message
...
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

--
Message posted via http://www.officekb.com



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:54 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"