Find Word

R

RyanW

I have an automation client and need to modify my find function to find all
occurrences of these types of merge fields. They always start with DDD and
are followed by any number of words separated by an underscore. Examples:

DDD_TEST
DDD_TODAYS_DATE
DDD_TODAYS_DATE_TIME
DDD_SOMETHING_ELSE_MORE_MUCHMORE

I have this so far, but it only works with 1 Underscore (DDD_TEST is
selected), not multiple.

<FCL_*([a-z,A-Z,0-9]@)>
 
G

Graham Mayor

If it is of any assistance toggle the field codes to show the content then
search for
^d Mergefield DDD

This will not of course isolate *only* those fields listed in the presence
of others beginning with DDD

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
R

RyanW

Actually they are not "Merge Fields" they are just text.

Graham Mayor said:
If it is of any assistance toggle the field codes to show the content then
search for
^d Mergefield DDD

This will not of course isolate *only* those fields listed in the presence
of others beginning with DDD

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


I have an automation client and need to modify my find function to
find all occurrences of these types of merge fields. They always
start with DDD and are followed by any number of words separated by
an underscore. Examples:

DDD_TEST
DDD_TODAYS_DATE
DDD_TODAYS_DATE_TIME
DDD_SOMETHING_ELSE_MORE_MUCHMORE

I have this so far, but it only works with 1 Underscore (DDD_TEST is
selected), not multiple.

<FCL_*([a-z,A-Z,0-9]@)>
 
G

Graham Mayor

Your original post said merge fields? If you can explain *exactly* what we
are dealing with it may be possible to suggest a solution. In the meantime
http://www.gmayor.com/replace_using_wildcards.htm may help.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Actually they are not "Merge Fields" they are just text.

Graham Mayor said:
If it is of any assistance toggle the field codes to show the
content then search for
^d Mergefield DDD

This will not of course isolate *only* those fields listed in the
presence of others beginning with DDD

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


I have an automation client and need to modify my find function to
find all occurrences of these types of merge fields. They always
start with DDD and are followed by any number of words separated by
an underscore. Examples:

DDD_TEST
DDD_TODAYS_DATE
DDD_TODAYS_DATE_TIME
DDD_SOMETHING_ELSE_MORE_MUCHMORE

I have this so far, but it only works with 1 Underscore (DDD_TEST is
selected), not multiple.

<FCL_*([a-z,A-Z,0-9]@)>
 
R

RyanW

I would like to search (find) for the following texts in MS Word and have
them highlighted.

FCL_TEST_C_E_E_E_E_E_E
FCL_TEST_A
FCL_TEST_A_B
FCL_TEST_A_EEE_B_C
FCL_TEST_A_B_CFFG_D
--any block of characters starting with FCL_

Each time it will start with FCL_, but after that there could be any number
of words and underscores to search on. I n the Find dialog, how would I
write criteria to do this? Here is what I have so far.

<FCL_*([a-z,A-Z,0-9]@)>

This works, but it only gets to the first _ and highlights that.

Graham Mayor said:
Your original post said merge fields? If you can explain *exactly* what we
are dealing with it may be possible to suggest a solution. In the meantime
http://www.gmayor.com/replace_using_wildcards.htm may help.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Actually they are not "Merge Fields" they are just text.

Graham Mayor said:
If it is of any assistance toggle the field codes to show the
content then search for
^d Mergefield DDD

This will not of course isolate *only* those fields listed in the
presence of others beginning with DDD

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>



RyanW wrote:
I have an automation client and need to modify my find function to
find all occurrences of these types of merge fields. They always
start with DDD and are followed by any number of words separated by
an underscore. Examples:

DDD_TEST
DDD_TODAYS_DATE
DDD_TODAYS_DATE_TIME
DDD_SOMETHING_ELSE_MORE_MUCHMORE

I have this so far, but it only works with 1 Underscore (DDD_TEST is
selected), not multiple.

<FCL_*([a-z,A-Z,0-9]@)>
 
G

Graham Mayor

It all boils down to what *ends* the string, rather than what is included in
it. Assuming a space, a line feed or a paragraph, then the following should
work. Add any other possibilities in the square brackets of the search
string:

Dim rngTemp As Range
Set rngTemp = ActiveDocument.Range(Start:=0, End:=0)
With rngTemp.Find
.ClearFormatting
.MatchWildcards = True
.Highlight = False
With .Replacement
.ClearFormatting
.Highlight = True
End With
.Execute replace:=wdReplaceAll, Forward:=True, _
FindText:="FCL*[ ^13^l]", _
ReplaceWith:="^&", Format:=True
End With


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


I would like to search (find) for the following texts in MS Word and
have them highlighted.

FCL_TEST_C_E_E_E_E_E_E
FCL_TEST_A
FCL_TEST_A_B
FCL_TEST_A_EEE_B_C
FCL_TEST_A_B_CFFG_D
--any block of characters starting with FCL_

Each time it will start with FCL_, but after that there could be any
number of words and underscores to search on. I n the Find dialog,
how would I write criteria to do this? Here is what I have so far.

<FCL_*([a-z,A-Z,0-9]@)>

This works, but it only gets to the first _ and highlights that.

Graham Mayor said:
Your original post said merge fields? If you can explain *exactly*
what we are dealing with it may be possible to suggest a solution.
In the meantime http://www.gmayor.com/replace_using_wildcards.htm
may help.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Actually they are not "Merge Fields" they are just text.

:

If it is of any assistance toggle the field codes to show the
content then search for
^d Mergefield DDD

This will not of course isolate *only* those fields listed in the
presence of others beginning with DDD

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>



RyanW wrote:
I have an automation client and need to modify my find function to
find all occurrences of these types of merge fields. They always
start with DDD and are followed by any number of words separated
by an underscore. Examples:

DDD_TEST
DDD_TODAYS_DATE
DDD_TODAYS_DATE_TIME
DDD_SOMETHING_ELSE_MORE_MUCHMORE

I have this so far, but it only works with 1 Underscore (DDD_TEST
is selected), not multiple.

<FCL_*([a-z,A-Z,0-9]@)>
 

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