Reply
 
Thread Tools Display Modes
  #1   Report Post  
Alessio
 
Posts: n/a
Default Included Property in Word 2003 MailMerge

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   Report Post  
Peter Jamieson
 
Posts: n/a
Default

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

Posting Rules

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
In typing dates in Word, i.e. "January 12" how do you keep the "1. Carol Microsoft Word Help 2 January 12th 05 09:09 PM
word xp crashes after macros are recorded kharris0405 Microsoft Word Help 3 January 11th 05 11:50 PM
WP Delay Code - Word Equiv Mike G - Milw, WI Microsoft Word Help 6 January 10th 05 05:12 PM
macro in word js Microsoft Word Help 1 December 28th 04 04:01 AM
Acrobat writer 5.0 Compatibility with word 2003 Norman Marshall Microsoft Word Help 1 November 25th 04 12:12 PM


All times are GMT +1. The time now is 08:42 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"