Word count

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using Word 2000 Professional, and know how to get the standard word
count. However, I understand that Word counts everything between the spaces
as a word. I am in an industry that counts words differently.

I need to know if there is a way to adjust Word to count words as my
industry does, which is every 6 characters (letters, spaces, etc.) as one
word. Can anyone help me out? Thank you.
 
There's no way to adjust the word count as such -- but why not just take the
character count and divide by six?
 
The following macro uses a wildcard replacement to replace every six
characters with themselves

The number of replacements is the count and it is displayed in the status
bar at the bottom of the Word screen when the macro is run.

If there's a way to capture that count, for insertion in the document I
don't know it so I have cross posted to the vba group to take counsel from
the more experienced vba programmers who lurk there :)

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "?{6}"
.Replacement.Text = "^&"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute replace:=wdReplaceAll
End Sub

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
You could use this field { = { NUMCHARS }/6 } except that unfortunately
NUMCHARS does not include spaces. So you may need Graham's macro.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
The talented chaps in the vba group came up with a simpler solution, which
has not been cross posted back here. Though mine still works :)

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Given that the link to the vba group has been broken and that the OP may not
know how to find it, the final macro, by team effort is:

Sub SpecWordCount()
Dim charCnt As Long
Dim lineCnt As Long
Dim specWordCnt As Integer

charCnt = ActiveDocument.Characters.Count
lineCnt = ActiveDocument.ComputeStatistics(wdStatisticLines)
specWordCnt = (charCnt - lineCnt) \ 6
MsgBox "There are " & specWordCnt & " word units in this document."
End Sub

I take no credit for the outcome ;)

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Thank you. This post seems to be the most helpful from what I've seen so
far. I don't know VBA, and forgot what little VB I learned 2 years ago. As
far as this post goes, unfortunately the start of each, "chapter," has that
word, and the chapter number at the head of it, followed by a blank line.
This would skew the count a bit, but I think it would still give a more
accurate count than what I've been using.

Your help is appreciated. Thank you again.

Danny
 
Macropod,

I don't think numchar counts spaces. If I remember correctly the OP
wanted to include spaces in the count.
 
Hi Suzanne,

If you want to count spaces also, you could use:
{=({NUMCHARS }+{NUMWORDS })/6 }
This, of course, would include para & line breaks in the count too. That's
because the formula assumes that there is a space before or after each word,
but this doesn't necessarily apply at para ends or lines ended with a line
break.

Cheers
 
Hi Greg,

In that case, see the reply I just posted to Suzanne Barnhill on the same
topic.

Cheers
 
Sounds like the best simple solution.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
macropod,

The paragraph and linebreaks is why we haven't been able to come up
with a non-VBA solution. The OP didn't mention wanting paragraphs and
linebreaks counted.

However, based on his reply, he didn't seem very concerned about
accurracy so just about any method proposed would work.
 
Actually, I didn't even think about paragraph and linebreaks. I don't want
them counted and part of the word count, it would just throw the count off.
I want words, meaning 6 characters including: letters, spaces, punctuation,
and symbols (and anything else I missed that are actual characters).
 
Danny,

That is why I think this will work:

Sub SpecWordCount()
Dim charCnt As Long
Dim lineCnt As Long
Dim specWordCnt As Integer


charCnt = ActiveDocument.Characters.Coun­t
lineCnt = ActiveDocument.ComputeStatisti­cs(wdStatisticLines)
specWordCnt = (charCnt - lineCnt) \ 6
MsgBox "There are " & specWordCnt & " word units in this docoment."
End Sub
 
Thanks. I'll have to try it. There's one more question though. I don't
know how to use VBA, alone or within MS Word. How do I insert this code, and
where?

Danny
 
I've tried, but can't seem to figure it out. I have VB.net on my computer &
think it might be somehow interfering with VBA on Word. For some reason,
Word is telling me somethine about needing to enable macros when I try to run
it.
 
You appear to have your macro security set to high. Change it to Medium and
to trust installed templates and add-ins.

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Back
Top