WordBasic: Determining the Number of Records in Data Source |
Q123691
When you are writing a macro, you may need to know how many records are in the attached mail merge data source. This article lists a sample macro that you can use to determine the number of records in the attached data source.
Run the following macro from the main document to determine the number of
records in the attached data source.
WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN
RISK. Microsoft provides this macro code "as is" without warranty of any
kind, either express or implied, including but not limited to the implied
warranties of merchantability and/or fitness for a particular purpose.
Sub MAIN
If MailMergeMainDocumentType() <> - 1 Then
MailMergeLastRecord
MsgBox Str$(MailMergeGoToRecord()) + " records"
End If
End Sub
The MailMergeLastRecord statement displays the last record in the data
source if there are no query options. The MailMergeGoToRecord() function
returns the number of the displayed record.
Additional query words: 6.0 winword word6
Keywords : kbofficeprog
Issue type :
Technology :
|
Last Reviewed: March 28, 2000 © 2001 Microsoft Corporation. All rights reserved. Terms of Use. |