The following macro will count all the words in all the documents in a
folder of your choice:
Sub CountWordsInFolder()
Dim myFile As String
Dim PathToUse As String
Dim MyDoc As Document
Dim iFld As Integer
Dim wdCount As Integer
wdCount = 0
With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
PathToUse = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With
If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(PathToUse, 1) = Chr(34) Then
PathToUse = Mid(PathToUse, 2, Len(PathToUse) - 2)
End If
myFile = Dir$(PathToUse & "*.do*")
While myFile <> ""
Set MyDoc = Documents.Open(PathToUse & myFile)
wdCount = wdCount +
ActiveDocument.BuiltInDocumentProperties(wdPropertyWords)
MyDoc.Close SaveChanges:=wdDoNotSaveChanges
myFile = Dir$()
Wend
MsgBox wdCount
End Sub
http://www.gmayor.com/installing_macro.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site
www.gmayor.com
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>