need to count word total for 1200 documents

D

Donald C. McNeilly

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
 
S

Suzanne S. Barnhill

I can't imagine trying to prepare any book from 1200+ individual documents.
Even if you don't combine *all* of them into a single document, I would
still just divide the book into a few files. How many will depend on the
length of the total. If this is the Encyclopaedia Britannica, then one
document per volume might be feasible. If it's a single-volume encyclopedia,
you might get by with four or five documents.
 
D

Doug Robbins

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top