![]() |
|
#2
|
|||
|
|||
|
Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oCol As New Collection
Dim lngIndex As Long
Selection.Find.ClearFormatting
Selection.Find.Highlight = True
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
While .Execute
Selection.Range.HighlightColorIndex = wdAuto
oCol.Add Selection.Range.Text
Selection.Collapse wdCollapseEnd
Wend
End With
For lngIndex = 1 To oCol.Count
Debug.Print oCol.Item(lngIndex)
Next lngIndex
lbl_Exit:
Exit Sub
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Formatting- Apply changes to highlighted text results in same change to other text
|
sential | Word | 6 | 01-10-2014 03:22 PM |
Convert String Array to Integer Array from a User Input?
|
tinfanide | Excel Programming | 4 | 12-26-2012 08:56 PM |
Selection of all Text for a specific page in word is spanning selection across pages
|
ramsgarla | Word VBA | 9 | 12-05-2012 03:23 AM |
Prepare report/list of all highlighted items
|
nrschmid | Word | 1 | 10-05-2011 06:26 PM |
| Highlighted Selection on Action Settings | mos7sad | PowerPoint | 0 | 10-12-2009 07:48 AM |