WD: WordBasic ToolsWordCount Command Returns Incorrect Values |
Q176750
When you use the Microsoft Word WordBasic ToolsWordCount command, the number of Words returned may be incorrect based upon the current selection.
The Tools Word Count feature in Word must be updated before an accurate count will appear.
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.
The following example WordBasic macro obtains the values of the
ToolsWordCount dialog, updates the dialog, again retrieves the updated
values and displays the correct number of selected Words.
Select the text to return a word count for prior to running the following
macro.
Sub Main
' Define the dialog record.
Dim dlg as ToolsWordCount
GetCurValues dlg
' Update the dialog values.
ToolsWordCount dlg
' Retrieve the updated values.
GetCurValues dlg
' Display the number of selected words.
MsgBox dlg.Words
End Sub
For additional information, please see the following articles in the Microsoft Knowledge Base:
Q97593 Word For Windows Reports Incorrect Number of Words in Document
Q92929 WD: Macros to Count the Number of Document Paragraphs and Lines
Q114180 WD: Word Count Does Not Count Spaces
Q173707 OFF97: How to Run Sample Code from Knowledge Base Articles
Additional query words:
Keywords : wordnt kbmacroexample winword ntword macword
Issue type : kbhowto
Technology :
|
Last Reviewed: November 4, 2000 © 2001 Microsoft Corporation. All rights reserved. Terms of Use. |