Word 2007 - How to get number of characters witt spaces from more

G

Guest

I have 22 DOC files and need to know how many characters with spaces I have.

I need to count number of standard sites (1800 characters for page with
spaces)
 
D

Dawn Crosier, Word MVP

Right Click on the Status Bar and be sure that you have Word Count added to
your status bar.

Then you can click on the Word Count button on the Status Bar and the older
dialog box will open to indicate the number of spaces in either your
selection or the entire document.

--
Dawn Crosier
Microsoft MVP
"Education Lasts a Lifetime"

This message was posted to a newsgroup, Please post replies and questions
to the group so that others can learn as well.
I have 22 DOC files and need to know how many characters with spaces I have.

I need to count number of standard sites (1800 characters for page with
spaces)
 
G

Guest

I know this functionality.
But I thought how to get it from more DOC documents at once.
 
D

Dawn Crosier, Word MVP

You would have to run a macro against your folder, which would open each
document and perform the word count.
--
Dawn Crosier
Microsoft MVP
"Education Lasts a Lifetime"

This message was posted to a newsgroup, Please post replies and questions
to the group so that others can learn as well.
I know this functionality.
But I thought how to get it from more DOC documents at once.
 
G

Graham Mayor

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

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Guest

Thank you Graham
I installed the macro,but it not works by me.
I can start the macro, select the folder, but than nothing happen.

I start the macro from a new empty doc file, where is my macro associated.
 
G

Graham Mayor

The only reason I can think of is that you may not be using an English
version of Windows and that your version has a different quote character
where English uses CHR(34)

The two lines
wdCount = wdCount +
ActiveDocument.BuiltInDocumentProperties(wdPropertyWords)
should be one line

The macro should open each document in a folder and keep a running total of
the words, which it then presents in a message box.
It will crash if the documents are merge documents or have passwords.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Guest

I corected this line in VBA Editorbefore I started the macro.
I have no erros if I start the macro. I will try it again.
 

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