Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
repetitive long sentances, how do i store and reused them in word | Microsoft Word Help | |||
Count repetitive words | Microsoft Word Help | |||
How do I create a macro that will do repetitive tasks? | Microsoft Word Help | |||
How do I automate repetitive entries in a template? | Microsoft Word Help | |||
Is there a way repetitive words can be highlighted by default in . | Microsoft Word Help |