Microsoft KB Archive/60344

Word for Windows Macro to Find Total Number Pages in Document PSS ID Number: Q60344 Article last modified on 07-14-1994

1.00 1.10 1.10a 2.00 2.00a 2.00a-CD 2.00b 2.00c

WINDOWS

= SUMMARY =

The following are Word for Windows macros that returns the total number of pages in a document:

The WordBasic SelInfo command returns the total number of document pages in Word version 2.x for Windows. The following example macro displays the total number of pages in the document’s status bar.

Sub MAIN x = SelInfo(4) Print x End Sub

The following Word version 2.x for Windows macro retrieves the total number of document pages from the File Summary Info dialog.

Sub MAIN Dim FileSumInfoBox As FileSummaryInfo GetCurValues FileSumInfoBox A$ = FileSumInfoBox.NumPages Print A$ End Sub

The page number is returned in A$ in the status bar.

The following Word version 1.x for Windows macro retrieves the total number of document pages from the Edit Summary Info dialog.

Sub MAIN Dim EditSumInfoBox As EditSummaryInfo GetCurValues EditSumInfoBox A$ = EditSumInfoBox.NumPages Print A$ End Sub

The page number is returned in A$ in the status bar.

For more information on the EditSummaryInfo dialog box, refer to pages 350-351 in the “Word for Windows User’s Reference.”

For more information on the EditSummaryInfo command, refer to page 42 in the “Word for Windows Technical Reference.”

Additional reference words: w4wmacro 1.00 1.10 1.10a 2.00 2.00a winword 2.00a-CD 2.00b 2.00c

=
================================================================

Copyright Microsoft Corporation 1994.