Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
tturner80126 tturner80126 is offline
external usenet poster
 
Posts: 1
Default How do I extract duplicate words in a doc?

I am trying to identify duplicate words in a document and either extract or
highlight.
After researching this, I am at a loss. Is this possible, and if so, what
is the procedure?

Thx in advance for the help.
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 285
Default How do I extract duplicate words in a doc?

You can highlight (or delete) duplicated words using a macro something like
this:
Sub FlagDupWords()
Dim oCol As Collection
Dim oWord As Range
Set oCol = New Collection
For Each oWord In ActiveDocument.Words
On Error GoTo Err_Handler
oCol.Add LCase(Trim(oWord)), LCase(Trim(oWord))
Err_ReEntry:
On Error GoTo 0
Next
Exit Sub
Err_Handler:
If Err.Number = 457 Then
MsgBox oWord & " is a duplicated word and will be flagged."
If oWord.Characters.Last = " " Then oWord.MoveEnd wdCharacter, -1
oWord.HighlightColorIndex = wdBrightGreen
Resume Err_ReEntry
Else
MsgBox Err.Number & " " & Err.Description
End If
End Sub


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~


"tturner80126" wrote in message
...
I am trying to identify duplicate words in a document and either extract or
highlight.
After researching this, I am at a loss. Is this possible, and if so, what
is the procedure?

Thx in advance for the help.



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
code to remove all duplicate words in a document? gil Microsoft Word Help 6 January 26th 08 12:18 AM
Help! Words duplicate when you hit spacebar brian289 Microsoft Word Help 1 January 31st 07 06:57 PM
How can I extract specific words from a document to form a glossar Hayden Microsoft Word Help 0 June 30th 06 02:54 PM
How do I duplicate words in a list format MABS Microsoft Word Help 1 April 26th 06 11:28 AM


All times are GMT +1. The time now is 08:18 PM.

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"