#1   Report Post  
Posted to microsoft.public.word.docmanagement
ReadAllAboutIt ReadAllAboutIt is offline
external usenet poster
 
Posts: 1
Default repetitive word use

How can I get Word to either highlight a repetitive word or list the number
of times the same word is used in a newspaper column? It is insidious and
probably subconscious but on a re-read the same word will sometimes be in 3
of the last 10 sentences. I need a bell to ring or something. Thanks,
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
JoAnn Paules JoAnn Paules is offline
external usenet poster
 
Posts: 4,241
Default repetitive word use

You could do a find and replace. Look for a word and replace it with itself
with different formatting.

--

JoAnn Paules
MVP Microsoft [Publisher]
Tech Editor for "Microsoft Publisher 2007 For Dummies"



"ReadAllAboutIt" wrote in message
...
How can I get Word to either highlight a repetitive word or list the
number
of times the same word is used in a newspaper column? It is insidious and
probably subconscious but on a re-read the same word will sometimes be in
3
of the last 10 sentences. I need a bell to ring or something. Thanks,


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 264
Default repetitive word use

This is an adaptation of a larger word usage macro and may suit your
needs. It basically hightlights all words in the defined range that
are repeated 3 or more times with random highlight colors.



Option Explicit
Sub ScratchMacro()
Dim aWord As Range 'Raw word pulled from doc
Dim SingleWord As String 'Processed raw word
Dim Words() As String 'Array to hold unique words
Dim Freq() As Integer 'Frequency counter for Unique Words
Dim WordNum As Integer 'Number of unique words
Dim Count As Long 'Total words in the document
Dim Excludes As String 'Words to be excluded
Dim Specifics As String 'Specific words to process
Dim bSpecifics As Boolean 'Logic router
Dim Found As Boolean 'Temporary flag
Dim j, k, l, Temp As Integer 'Temporary variables
Dim lngProcessedWords As Long 'Total processed words in document
Dim rNumber As Long

Dim oRng As Word.Range


Excludes = InputBox$("Enter words that you wish to exclude. " _
& "Place each word within square brackets [ ]. " _
& "Example: [is][a].", "Excluded Words", "")
If Len(Excludes) = 0 Then
Specifics = InputBox("Enter any specific words you wish to process.
" _
& "Place each word withing squiggly brackets { }. " _
& "Example: {I}{me}{you}.", "Specific Words", "")
If Len(Specifics) 0 Then bSpecifics = True
End If
System.Cursor = wdCursorWait
WordNum = 0
Count = ActiveDocument.Words.Count
ReDim Words(Count)
ReDim Freq(Count)
'Control the repeat
For Each aWord In ActiveDocument.Words
SingleWord = Trim(LCase(aWord))
If SingleWord "a" Or SingleWord "z" Then
SingleWord = ""
End If
If InStr(Excludes, "[" & SingleWord & "]") Then SingleWord = ""
If Not bSpecifics Then
If Len(SingleWord) 0 Then
lngProcessedWords = lngProcessedWords + 1
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
End If
Else
If Len(SingleWord) 0 And InStr(Specifics, "{" & SingleWord &
"}") Then
lngProcessedWords = lngProcessedWords + 1
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
End If
End If
Count = Count - 1
StatusBar = "Remaining: " & Count & " Unique: " & WordNum
Next aWord
For j = 1 To WordNum
Set oRng = ActiveDocument.Range
If Freq(j) 2 Then
rNumber = GetrNumber
With oRng.Find
.Text = Words(j)
While .Execute
oRng.HighlightColorIndex = rNumber
Wend
End With
End If
Next j
ActiveDocument.Range(0, 0).Select
End Sub
Function GetrNumber() As Long
Dim i As Long
Dim vbErrObject As ErrObject
Randomize
On Error GoTo Err_Handler
Err_Resume:
i = Int(14 * Rnd + 1)
Select Case i
Case 1, 2, 3, 5, 6, 7, 9, 10, 11, 12, 13, 14
i = i
Case Else
Err.Raise vbErrObject + 1
End Select
GetrNumber = i
Exit Function
Err_Handler:
Resume Err_Resume
End Function



On Aug 19, 7:05*pm, ReadAllAboutIt
wrote:
How can I get Word to either highlight a repetitive word or list the number
of times the same word is used in a newspaper column? It is insidious and
probably subconscious but on a re-read the same word will sometimes be in 3
of the last 10 sentences. I need a bell to ring or something. Thanks,


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
repetitive long sentances, how do i store and reused them in word Peter Building Surveyor Microsoft Word Help 3 February 19th 13 04:26 AM
Count repetitive words itgreenwich Microsoft Word Help 5 October 9th 07 07:41 PM
How do I create a macro that will do repetitive tasks? jico Microsoft Word Help 1 January 31st 07 05:33 AM
How do I automate repetitive entries in a template? EricBlaine Microsoft Word Help 2 August 20th 05 12:07 AM
Is there a way repetitive words can be highlighted by default in . Hemant Microsoft Word Help 7 December 1st 04 11:26 PM


All times are GMT +1. The time now is 08:40 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"