WD: Macros to Count the Number of Document Paragraphs and LinesLast reviewed: July 30, 1997Article ID: Q92929 |
The information in this article applies to:
SUMMARYThe number of paragraphs and lines in a document are counted and displayed in the Document Properties dialog box (Word versions 7.x) or in the Summary Info dialog box of earlier Word versions. To access this information from a macro, see the following examples.
MORE INFORMATIONNOTE: Microsoft provides macros "as is" 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.
Word Versions 6.x and 7.xTo return the number of paragraphs in a document, use the following macro:
Sub MAIN FileSummaryInfo .Update Dim dlg As FileSummaryInfo GetCurValues dlg para$ = dlg.NumParas MsgBox "There are " + para$ + " paragraphs in the document." End SubTo return the number of lines in a document:
Sub MAIN FileSummaryInfo .Update Dim dlg As FileSummaryInfo GetCurValues dlg line$ = dlg.NumLines MsgBox "There are " + line$ + " lines in the document." End Sub Word version 2.x for WindowsTo create a WordBasic macro that can be used to count the number of paragraphs or lines in a Word version 2.0 document and display the result in a message box, do the following:
REFERENCES"Microsoft Word for Windows and OS/2 Technical Reference," pages 103- 107"Using WordBasic," by WexTech Systems and Microsoft, pages 251 and 267
|
Additional query words: LineDown ParaDown While
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |