Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
Hello,
I have already read Cindy's and Peter's messages about the Included property of the MailMergeDataSource object, and I have a new question. My C++ application is written with Visual Studio.Net 2003. It uses OLE to automate the whole mailmerge process. I have problems when dealing with two different kinds of MailMerge documents: Since the application must deal with mailmerge documents created selecting only some of the records of the data source, the application first cycles through all the data source records (selecting them with wdFirstDataSourceRecord and wdNextDataSourceRecord), and for each of them checks the Included property, thus knowing whether that record must be merged or not. With this cycle, the application finally knows the number of records to be merged, say NRecords. Then, it cycles NRecords times, using wdFirstRecord and wdNextRecord, merging data for each record, thus merging only the data records that the creator of the document intended to merge. But, when dealing with a mailmerge document created without de-selecting any records (i.e., a document stating that ALL records must be merged), an exception is thrown when checking the Included property for the first record of the data source, the one selected with wdFirstDataSourceRecord! How can I solve this problem? I cannot avoid running the first cycle, otherwise the application would not know how many records must be included, and thus another exception would be raised when issuing the ActiveRecord = wdNextRecord statement while the current record is the last one included by the creator. Thank you Alessio |
#2
![]() |
|||
|
|||
![]()
Yes, nasty.
Things seem to work after you have displayed the mailmerge recipients dialog box. You could do that using Dialogs(wdDialogMailMergeRecipients).Display TimeOut:=1 but I don't know how to suppress the dialog display in that case, should you need to do that. Peter Jamieson "Alessio" wrote in message om... Hello, I have already read Cindy's and Peter's messages about the Included property of the MailMergeDataSource object, and I have a new question. My C++ application is written with Visual Studio.Net 2003. It uses OLE to automate the whole mailmerge process. I have problems when dealing with two different kinds of MailMerge documents: Since the application must deal with mailmerge documents created selecting only some of the records of the data source, the application first cycles through all the data source records (selecting them with wdFirstDataSourceRecord and wdNextDataSourceRecord), and for each of them checks the Included property, thus knowing whether that record must be merged or not. With this cycle, the application finally knows the number of records to be merged, say NRecords. Then, it cycles NRecords times, using wdFirstRecord and wdNextRecord, merging data for each record, thus merging only the data records that the creator of the document intended to merge. But, when dealing with a mailmerge document created without de-selecting any records (i.e., a document stating that ALL records must be merged), an exception is thrown when checking the Included property for the first record of the data source, the one selected with wdFirstDataSourceRecord! How can I solve this problem? I cannot avoid running the first cycle, otherwise the application would not know how many records must be included, and thus another exception would be raised when issuing the ActiveRecord = wdNextRecord statement while the current record is the last one included by the creator. Thank you Alessio |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
In typing dates in Word, i.e. "January 12" how do you keep the "1. | Microsoft Word Help | |||
word xp crashes after macros are recorded | Microsoft Word Help | |||
WP Delay Code - Word Equiv | Microsoft Word Help | |||
macro in word | Microsoft Word Help | |||
Acrobat writer 5.0 Compatibility with word 2003 | Microsoft Word Help |