Microsoft KB Archive/85102

{|
 * width="100%"|

Must Delete and Reinstall Windows 3.1 Drivers After Setup

 * }

Q85102

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
 * Microsoft Word for Windows, versions 7.0, 7.0a
 * Microsoft Word for the Macintosh, versions 6.0, 6.0.1

-

SUMMARY
In Microsoft Word for Windows, you can access the information in the Summary Info dialog box using the Microsoft WordBasic macro language and then post the information in a message box or insert the information into the active document.

MORE INFORMATION
To obtain the value of any field in the Summary Info dialog box, use the GetCurValues statement to access the information, then assign a string variable (A$) to the value of the field desired. The following macro displays the number of words, characters, and pages in the active document:

Word 7.x, 6.x and 2.x
Sub MAIN FileSummaryInfo .Update Dim dlg As Dialog FileSummaryInfo GetCurValues dlg A$ = dlg.NumWords B$ = dlg.NumChars C$ = dlg.NumPages MsgBox &quot;Words =&quot; + A$ + Chr$(160) + &quot;Characters = &quot; + B$ \ + Chr$(160) + &quot; Pages =&quot;  + C$ End Sub If you are using Word version 1.x for Windows, change the two occurrences of FileSummaryInfo to EditSummaryInfo. The .Update argument for the FileSummaryInfo command updates the summary information so that the number of words, number of characters, and number of pages are most accurate.

Additionally, you can use a similar macro to insert the contents of fields within the Summary Info dialog box at the insertion position in the document. The following macro inserts the Title, Subject, and Author text as it appears in the Summary Info dialog box:

Word for Windows 6.0 and 2.0
Sub MAIN FileSummaryInfo .Update Dim dlg As Dialog FileSummaryInfo GetCurValues dlg A$ = dlg.Title B$ = dlg.Subject C$ = dlg.Author Insert &quot;Title:&quot; + Chr$(160) + A$  InsertPara Insert &quot;Subject:&quot; + Chr$(160) + B$  InsertPara Insert &quot;Author:&quot; + Chr$(160) + C$  InsertPara End Sub Word version 6.0 for Windows includes the following new parameters for the FileSummaryInfo statement:

.FileSize

.NumParas

.NumLines If you are using Word version 1.x for Windows, change the two occurrences of FileSummaryInfo to EditSummaryInfo.

Note: &quot;Using WordBasic&quot; for Word version 2.x for Windows and the online documentation incorrectly list the following arguments as numbers instead of text variables:

.NumPages

.NumWords

.NumChars Note: Microsoft provides macros &quot;as is&quot; without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

For information about how to do this in Word 97, please see the following article(s) in the Microsoft Knowledge Base:

"Q158768 Sample VB Code to Set, Retrieve Summary Information"