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
Lise is working with 50 small documents, many less than a page long. All are in separate files (no master or subdocuments). She'd like to know the total word count in all the files and wonders if there is an easy way to get the count.
One option is to use a third-party add-in that can calculate the word counts for you. Here are three suggestions you may want to check out:
WordCounter: http://www.editorium.com/counter.htm FineCount: http://www.tilti.com/new/en/index.php?id=2_finecountv2 Total Assistant: http://www.surefiresoftware.com/totalassistant/
Of course, if you prefer to "roll your own" rather than to rely on somebody else's solution, you can create a relatively simple macro that will step through each file in a folder and calculate a total word count.
Sub GetWordCount()
Dim docname As String
Dim NumWords As Long
Dim NumFiles As Integer
Dim PathName As String
PathName = "c:\mypath\"
NumWords = 0
docname = Dir(PathName & "*.doc*")
While docname <> ""
NumFiles = NumFiles + 1
Documents.Open FileName:=PathName & docname, Visible:=False
Documents(docname).Activate
NumWords = NumWords + ActiveDocument.BuiltInDocumentProperties("Number of words").Value
Documents(docname).Close savechanges:=False
docname = Dir
Wend
MsgBox ("There are " & NumWords & " words in " & NumFiles & " documents.")
End Sub
To use the macro, make sure you change the PathName variable so that it reflects the path to the folder containing the documents you want to tally. (The path designation must end in a backslash.) When you run the macro, it displays the word count in a message box.
Tip #5595 applies to Microsoft Word versions: 97 2000 2002 2003 2007
Save Time! WordTips has been published weekly since early 1997. Past issues are available in convenient WordTips archives. Have your own enhanced archive of WordTips at your fingertips, available to use at any time!