View Single Post
  #3   Report Post  
Doug Robbins
 
Posts: n/a
Default

If you put all of the documents in one folder and modify the string in the
PathToUse statement in the following macro to point to that folder and then
you run this macro, it will count the words in all of the documents. For
1200 documents, I would put the kettle on to boil before you start.

Dim i As Long
Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document

PathToUse = "C:\Documents\"

'Error handler to handle error generated whenever
'the FindReplace dialog is closed

On Error Resume Next

'Initiate the counter i

i = 0

'Close all open documents before beginning

Documents.Close SaveChanges:=wdPromptToSaveChanges

'Set the directory and type of file to batch process

myFile = Dir$(PathToUse & "*.doc")

While myFile ""

'Open document
Set myDoc = Documents.Open(PathToUse & myFile)

'Increment the counter i with the number of words in the document

i = i + myDoc.Words.Count

myDoc.Close SaveChanges:=wdDoNoSaveChanges

'Next file in folder

myFile = Dir$()

Wend

MsgBox "Total number of words is " & i & "."


--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
"Donald C. McNeilly" wrote in message
...
Am preparing an encyclopedia that will have about 1200 + entries. Each
entry is a separate document. I need a total word count for all docs. I
can use an 'open' window showing the statistics and enter word count into
a spreadsheet but it seems as if there should be an easier way. Other
option might be to merge all the documents into one but have heard horror
stories about dealing with large docs in word. Also, I cannot find any
automatic way of doing this; just cut and paste each doc into one. That
would be as laborious as doing the spreadsheet count. Publisher is willing
to take the docs as individual entries so we have no need to merge them
all.
Appreciate any help. Have had great luck with the publisher group.

dcmc