![]() |
|
|
|
#1
|
|||
|
|||
|
Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Word.Range
Dim lngInstance As Long, lngCount As Long
lngCount = 0
Set oRng = Selection.Range 'or ActiveDocument.Range
With oRng.Find
.Text = InputBox("Text to find:")
lngInstance = InputBox("Sequenced number to find:")
While .Execute
lngCount = lngCount + 1
If lngCount = lngInstance Then
oRng.HighlightColorIndex = wdYellow
Exit Sub
oRng.Collapse wdCollapseEnd
End If
Wend
End With
lbl_Exit:
Exit Sub
End Sub
|
|
| Tags |
| formatting text, selective replacement |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Problem replacing text.
|
piritzo | Word | 2 | 06-22-2013 12:50 AM |
Creating a plain text content control for every instance of a word or phrase
|
RobsterCraw | Word VBA | 16 | 11-20-2012 03:25 PM |
Help with replacing text with wildcards
|
sbatson5 | Word | 2 | 04-13-2012 03:49 AM |
| Highlight text and find next instance | DrDOS | Word | 0 | 11-15-2010 04:02 PM |
| Replacing / editting text | LisaC | Word | 0 | 02-25-2010 03:40 AM |