Finding any sequence of 3 identical characters

N

Nomey

Dear all,

Is it possible (in Word XP 2002) to search for any sequence of three identical characters in a row, so 'aaa', 'bbb', 'ccc', etcetera?

Preferably without vba, but with wildcards, in the default Search and Replace window?

Best regards,
Shirley
 
D

Doug Robbins - Word MVP

I think that you would have to do something like

Dim i as Long, j as Long
Dim myrange as Range
For i = 65 to 128
Set myrange = ActiveDocument.Range
j = InStr(myrange, Chr(i) & Chr(i) & Chr(i))
If j > 0 then
With myrange
.Start = .Start + j - 1
.End = .Start + 3
.Select
Exit For
End With
End If
Next i


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
N

Nomey

Ah! Great. I'm glad it can be done without a macro, because the work needs to be carried out by people who have never used a macro.

Many thanks, Doug, Graham and Klaus.

Shirley
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top