What do you want to do with the data having found it? The following macro
will locate the data in square brackets that matches your layout and
assigns
it in turn to a range variable oRng. You can do what you want with that
range eg display it in a message box as in the example
Dim oRng As Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = "\[[0-9A-Z]{1,}\]"
Do While .Execute(Forward:=True, _
MatchWildcards:=True) = True
oRng.Start = oRng.Start + 1
oRng.End = oRng.End - 1
'orng is the text in the brackets e.g.
MsgBox oRng
oRng.Collapse wdCollapseEnd
Loop
End With
If you want it to find *anything* between square brackets change the line
.Text = "\[[0-9A-Z]{1,}\]"
to
.Text = "\[*\]"
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site
www.gmayor.com
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Hi all,
I have some data scattered in a word doc, but fortunately the data is
formated like R12345 and embraced inside [ ] like [R12345], in order
to
retrieve value R12345 ,
what am I going to do.
thank you so much for your help
Clara
.