
Tips.Net > WordTips Home > Tools > Word Count > Counting Words the Old Fashioned Way with WordBasic
Summary: Using the old editorial method of figuring out the number of words in a document. (This tip works with Microsoft Word 6, and Word 95.)
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
Take Control! Master the real power behind Word! Successfully master the secrets of powerful formatting and create documents that stand out from the rest. Best of all, you can create documents that are easy to maintain and quick to change.
Check out Word 2007 Styles and Templates today!
Uncover how you can master the full potential of printing your documents. Everything you wanted to know about printing and printers, using Word. (more information...)
Ask a Word Question
Make a Comment
Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips