Syntax
DocumentStatistics [.FileName = text] [, .Directory = text] [, .Template = text] [, .Title = text] [, .Created = text] [, .LastSaved = text] [, .LastSavedBy = text] [, .Revision = text] [, .Time = text] [, .Printed = text] [, .Pages = text] [, .Words = text] [, .Characters = text] [, .Paragraphs = text] [, .Lines = text] [, .FileSize = text]
Remarks
Used with a dialog record, DocumentStatistics returns information about the active document. In Word version 6.0, the arguments for the DocumentStatistics statement correspond to the information available in the Document Statistics dialog box (Summary Info command, File menu). Also, the arguments are read-only, which means that unlike other WordBasic statements, you cannot use DocumentStatistics to set a value. Instead, you use the DocumentStatistics dialog record in the same way you use a function: to return information.
In Word version 7.0, this statement is included for backward compatibility. You can use the document property statements and functions to access document statistics for the active document. For more information, see GetDocumentProperty().
Argument | Explanation | |
.FileName | The name of the document (the path is not included) | |
.Directory | The path in which the document is kept | |
.Template | The path and filename of the template attached to the document | |
.Title | The document's title | |
.Created | The date and time the document was created | |
.LastSaved | The date and time the document was last saved | |
.LastSavedBy | The author of the document | |
.Revision | The number of times the document has been saved | |
.Time | The total time spent editing the document | |
.Printed | The date and time the document was last printed | |
.Pages | The number of pages in the document | |
.Words | The number of words in the document | |
.Characters | The number of characters in the document | |
.Paragraphs | The number of paragraphs in the document | |
.Lines | The number of lines in the document | |
.FileSize | The size of the document in the form "36,352 Bytes" |
Note
To ensure you get the most up-to-date information when using a DocumentStatistics dialog record to return document statistics, include the instruction FileSummaryInfo .Update before defining the dialog record.
Example
This example uses the DocumentStatistics dialog record to obtain the number of words in the active document. You can use this example as a model for how to obtain the value of any DocumentStatistics argument.
FileSummaryInfo .Update 'Update document statistics Dim dlg As DocumentStatistics 'Create a dialog record GetCurValues dlg 'Fill record with values MsgBox "Number of words: " + dlg.Words
See Also
FileSummaryInfo, SelInfo()