Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 |