Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
PAG PAG is offline
external usenet poster
 
Posts: 3
Default How can I know how many times I used each word in a Word 2003 docu

How can I know how many times I used each word in a Word 2003 document?
  #2   Report Post  
Posted to microsoft.public.word.newusers
Terry Farrell Terry Farrell is offline
external usenet poster
 
Posts: 2,904
Default How can I know how many times I used each word in a Word 2003 docu

At its easiest, use Find and Replace to find and replace a word with itself.
The action will tell you how many replacements it made.

--
Terry Farrell - MSWord MVP

"PAG" wrote in message
...
How can I know how many times I used each word in a Word 2003 document?


  #3   Report Post  
Posted to microsoft.public.word.newusers
Suzanne S. Barnhill Suzanne S. Barnhill is offline
external usenet poster
 
Posts: 33,624
Default How can I know how many times I used each word in a Word 2003 docu

For *each* word you'd need a concordance, and I think there are macros
running around to generate one. But for a given word, Terry's Replace trick
will work in any version of Word; for more recent versions, you can use
"Find All" in the Find dialog, which also provides a number without having
to "replace."

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

"PAG" wrote in message
...
How can I know how many times I used each word in a Word 2003 document?



  #4   Report Post  
Posted to microsoft.public.word.newusers
PAG PAG is offline
external usenet poster
 
Posts: 3
Default How can I know how many times I used each word in a Word 2003

Hi Terry,

Thanks for your answer. But I would have liked Word to give me a list of the
words of a document in order, starting with the most used, ending with the
least used and the count for each word...Puting each word in search, find and
replace can take lots of time...

PAG

"Terry Farrell" wrote:

At its easiest, use Find and Replace to find and replace a word with itself.
The action will tell you how many replacements it made.

--
Terry Farrell - MSWord MVP

"PAG" wrote in message
...
How can I know how many times I used each word in a Word 2003 document?


  #5   Report Post  
Posted to microsoft.public.word.newusers
Terry Farrell Terry Farrell is offline
external usenet poster
 
Posts: 2,904
Default How can I know how many times I used each word in a Word 2003

I suggest posting this in the Word VBA newsgroup because it will probably
need a macro solution then.

Terry

"PAG" wrote in message
...
Hi Terry,

Thanks for your answer. But I would have liked Word to give me a list of
the
words of a document in order, starting with the most used, ending with the
least used and the count for each word...Puting each word in search, find
and
replace can take lots of time...

PAG

"Terry Farrell" wrote:

At its easiest, use Find and Replace to find and replace a word with
itself.
The action will tell you how many replacements it made.

--
Terry Farrell - MSWord MVP

"PAG" wrote in message
...
How can I know how many times I used each word in a Word 2003 document?





  #6   Report Post  
Posted to microsoft.public.word.newusers
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default How can I know how many times I used each word in a Word 2003

Run the following macro:

Sub WordFrequency()



Dim SingleWord As String 'Raw word pulled from doc
Const maxwords = 9000 'Maximum unique words allowed
Dim Words(maxwords) As String 'Array to hold unique words
Dim Freq(maxwords) As Integer 'Frequency counter for Unique
Words
Dim WordNum As Integer 'Number of unique words
Dim ByFreq As Boolean 'Flag for sorting order
Dim ttlwds As Long 'Total words in the document
Dim Excludes As String 'Words to be excluded
Dim Found As Boolean 'Temporary flag
Dim j, k, l, Temp As Integer 'Temporary variables
Dim tword As String '



' Set up excluded words
Excludes = ""
Excludes = InputBox$("Enter words that you wish to exclude,
surrounding each word with [ ].", _ "Excluded Words", "")
' Find out how to sort
ByFreq = True
Ans = InputBox$("Sort by WORD or by FREQ?", "Sort order", "FREQ")
If Ans = "" Then End
If UCase(Ans) = "WORD" Then
ByFreq = False
End If



Selection.HomeKey Unit:=wdStory
System.Cursor = wdCursorWait
WordNum = 0
ttlwds = ActiveDocument.Words.Count
Totalwords = ActiveDocument.Words.Count



' Control the repeat
For Each aword In ActiveDocument.Words
SingleWord = Trim(aword)
If SingleWord "A" Or SingleWord "z" Then SingleWord = ""
'Out of range?
If InStr(Excludes, "[" & SingleWord & "]") Then SingleWord = ""
'On exclude list?
If Len(SingleWord) 0 Then
Found = False
For j = 1 To WordNum
If Words(j) = SingleWord Then
Freq(j) = Freq(j) + 1
Found = True
Exit For
End If
Next j
If Not Found Then
WordNum = WordNum + 1
Words(WordNum) = SingleWord
Freq(WordNum) = 1
End If
If WordNum maxwords - 1 Then
j = MsgBox("The maximum array size has been exceeded.
Increase maxwords.", vbOKOnly)
Exit For
End If
End If
ttlwds = ttlwds - 1
StatusBar = "Remaining: " & ttlwds & " Unique: " & WordNum
Next aword



' Now sort it into word order
For j = 1 To WordNum - 1
k = j
For l = j + 1 To WordNum
If (Not ByFreq And Words(l) Words(k)) Or (ByFreq And
Freq(l) Freq(k)) Then k = l
Next l
If k j Then
tword = Words(j)
Words(j) = Words(k)
Words(k) = tword
Temp = Freq(j)
Freq(j) = Freq(k)
Freq(k) = Temp
End If
StatusBar = "Sorting: " & WordNum - j
Next j



' Now write out the results
tmpName = ActiveDocument.AttachedTemplate.FullName
Documents.Add Template:=tmpName, NewTemplate:=False
Selection.ParagraphFormat.TabStops.ClearAll
With Selection
For j = 1 To WordNum
.TypeText Text:=Words(j) & vbTab & Trim(Str(Freq(j))) &
vbCrLf
Next j
End With
ActiveDocument.Range.Select
Selection.ConvertToTable
Selection.Collapse wdCollapseStart
ActiveDocument.Tables(1).Rows.Add BeforeRow:=Selection.Rows(1)
ActiveDocument.Tables(1).Cell(1, 1).Range.InsertBefore "Word"
ActiveDocument.Tables(1).Cell(1, 2).Range.InsertBefore
"Occurrences"
ActiveDocument.Tables(1).Range.ParagraphFormat.Ali gnment =
wdAlignParagraphCenter
ActiveDocument.Tables(1).Rows.Add
ActiveDocument.Tables(1).Cell(ActiveDocument.Table s(1).Rows.Count,
1).Range.InsertBefore _

"Total words in Document"
ActiveDocument.Tables(1).Cell(ActiveDocument.Table s(1).Rows.Count,
2).Range.InsertBefore Totalwords
ActiveDocument.Tables(1).Rows.Add
ActiveDocument.Tables(1).Cell(ActiveDocument.Table s(1).Rows.Count,
1).Range.InsertBefore _

"Number of different words in Document"
ActiveDocument.Tables(1).Cell(ActiveDocument.Table s(1).Rows.Count,
2).Range.InsertBefore _

Trim(Str(WordNum))
System.Cursor = wdCursorNormal
' j = MsgBox("There were " & Trim(Str(WordNum)) & " different words
", vbOKOnly, "Finished")
Selection.HomeKey wdStory



End Sub


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"PAG" wrote in message
...
Hi Terry,

Thanks for your answer. But I would have liked Word to give me a list of
the
words of a document in order, starting with the most used, ending with the
least used and the count for each word...Puting each word in search, find
and
replace can take lots of time...

PAG

"Terry Farrell" wrote:

At its easiest, use Find and Replace to find and replace a word with
itself.
The action will tell you how many replacements it made.

--
Terry Farrell - MSWord MVP

"PAG" wrote in message
...
How can I know how many times I used each word in a Word 2003 document?




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to know how many times each word is used in a Word 2003 docume PAG Microsoft Word Help 1 May 6th 08 03:50 PM
Word 2003 is adding extra lines between some paragraphs in my docu bsc Microsoft Word Help 2 February 10th 07 08:45 PM
Word 2003 starts two times Johnny B. Microsoft Word Help 2 June 13th 06 10:04 PM
Why does Word 2003 "find" text only a few times? Hal in Minneapolis Microsoft Word Help 0 February 25th 06 04:38 AM
how do I change the company name in the properties of a word docu. msa New Users 3 March 14th 05 02:08 PM


All times are GMT +1. The time now is 10:34 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"