Welcome toWord.Tips.Net
Ask a Word Question
Make a Comment
Learn Access Now
Free Printable Forms
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips
Collapsing and Expanding Subdocuments
You probably already knew that Word provides a way to determine the number of words in a selection or in your entire document. Word has its own internal algorithms to figure out the proper count. This is great, if you need to know actual word counts.
Before the days of actual word counts, however, typists figured out the number of average words in a document. This was done by figuring out the number of characters typed, and then dividing that figure by five. For some purposes you may still need to figure word counts using this old-fashioned approach. This can be done with a simple WordBasic macro, as follows:
Sub MAIN
Title$ = "WordCount"
On Error Goto HugeString
InSelection = SelType()
If InSelection = 2 Or InSelection = 6 Then
WordCount = Int((Len(Selection$()) / 5) + 0.5)
WordCount$ = Mid$(Str$(WordCount), 2) + " word"
If WordCount > 1 Then WordCount$ = WordCount$ + "s"
MsgBox WordCount$, Title$
Else
Beep
MsgBox "No text selected", Title$, 16
End If
Goto Done
HugeString:
MsgBox "Selection too large", Title$, 48
Done:
End Sub
Tip #756 applies to Microsoft Word versions: 6 95
More Power! For some people, the prospect of creating Word macros can be scary. WordTips: The Macros can help you conquer your fears and you'll discover you're much more confident and productive as you make Word do exactly what you want. This is an invaluable source for learning macros. You are introduced to the topic in bite-sized chunks, pulled from past issues of WordTips. Learn at your own pace, exactly the way you want.