From: clara on
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
From: Jay Freedman on
See http://www.gmayor.com/replace_using_wildcards.htm. For the particular
data you described, the search term to use is

\[R[0-9]@\]

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

clara wrote:
> 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


From: Graham Mayor on
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
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>



"clara" <clara(a)discussions.microsoft.com> wrote in message
news:CF3CCE93-4E49-4F13-B29E-4C78024A6785(a)microsoft.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


From: clara on
Hi Jay,

thank you very much

Clara


"Jay Freedman" wrote:

> See http://www.gmayor.com/replace_using_wildcards.htm. For the particular
> data you described, the search term to use is
>
> \[R[0-9]@\]
>
> --
> Regards,
> Jay Freedman
> Microsoft Word MVP FAQ: http://word.mvps.org
> Email cannot be acknowledged; please post all follow-ups to the newsgroup so
> all may benefit.
>
> clara wrote:
> > 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
>
>
> .
>
From: clara on
Hi Graham,

Thank you very much, I'll try your code

Clara



"Graham Mayor" wrote:

> 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
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
>
> "clara" <clara(a)discussions.microsoft.com> wrote in message
> news:CF3CCE93-4E49-4F13-B29E-4C78024A6785(a)microsoft.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
>
>
> .
>