Hi all,

I would like to know if it is possible to search for more than 1 text using
find. I mean something like, Selection.find.execute findtext:="A" or "B" and
so on...
I know I could use an array to do the search for each findtext string, but
something like this would make my life easy! Please let me know.

Thanks a lot.

Vince

Re: Using OR condition in findtext by Doug

Doug
Fri Jul 30 03:20:33 CDT 2004

If you could come up with a wildcard string that is met by both "A" and "B"
and nothing else, it could be done.

For A and B themselves, it would be [AB]{1} But I guess that is not really
what you meant.

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
"fdde" <sdsad@fsd.com> wrote in message
news:uQHXiDfdEHA.1048@tk2msftngp13.phx.gbl...
> Hi all,
>
> I would like to know if it is possible to search for more than 1 text
> using
> find. I mean something like, Selection.find.execute findtext:="A" or "B"
> and
> so on...
> I know I could use an array to do the search for each findtext string, but
> something like this would make my life easy! Please let me know.
>
> Thanks a lot.
>
> Vince
>
>



Re: Using OR condition in findtext by fdde

fdde
Fri Jul 30 03:42:58 CDT 2004

Thank you for your reply. I guess I will have to stick to the array method
then. "AB" holds good only for single letter characters. It doesn't work
very well for super large strings. Also, is it possible to find any style
from a list of Styles using a range? I mean, can I have something like
Selection.find.style = "blah" or "blah" or "blah". Basically, I need to
change the text around if the style is one among many choices. The
conventional way to do this is to, of course, use an array. I was wondering
if anything quicker was possible. (Why do I get the feeling that I am asking
for too much!)

Many thanks.
Vince
"Doug Robbins" <dkr@NOmvpsSPAM.org> wrote in message
news:%23eKJW4gdEHA.4004@TK2MSFTNGP10.phx.gbl...
> If you could come up with a wildcard string that is met by both "A" and
"B"
> and nothing else, it could be done.
>
> For A and B themselves, it would be [AB]{1} But I guess that is not
really
> what you meant.
>
> --
> Please respond to the Newsgroup for the benefit of others who may be
> interested. Questions sent directly to me will only be answered on a
paid
> consulting basis.
>
> Hope this helps,
> Doug Robbins - Word MVP
> "fdde" <sdsad@fsd.com> wrote in message
> news:uQHXiDfdEHA.1048@tk2msftngp13.phx.gbl...
> > Hi all,
> >
> > I would like to know if it is possible to search for more than 1 text
> > using
> > find. I mean something like, Selection.find.execute findtext:="A" or "B"
> > and
> > so on...
> > I know I could use an array to do the search for each findtext string,
but
> > something like this would make my life easy! Please let me know.
> >
> > Thanks a lot.
> >
> > Vince
> >
> >
>
>



Re: Using OR condition in findtext by Jay

Jay
Wed Jul 28 23:03:41 CDT 2004

Hi Vince,

Sorry, you are asking more than VBA can deliver. The standard way to
do this is to loop through the array (of either find text or styles or
any other criteria) and do a separate find for each. There is no
quicker way except the wildcard search that Doug mentioned.

Jonathan West suggested a speedup that will work with text (but not
styles): pull the entire text of the document into a huge string, and
use InStr() to test whether the current item in the array occurs
anywhere in that string. If so, use .Find to locate the item in the
document; if not, go on to test the next item.

--
Regards,
Jay Freedman http://aspnet2.com/mvp.ashx?JayFreedman
Microsoft Word MVP FAQ: http://www.mvps.org/word

"fdde" <sdsad@fsd.com> wrote:

>Thank you for your reply. I guess I will have to stick to the array method
>then. "AB" holds good only for single letter characters. It doesn't work
>very well for super large strings. Also, is it possible to find any style
>from a list of Styles using a range? I mean, can I have something like
>Selection.find.style = "blah" or "blah" or "blah". Basically, I need to
>change the text around if the style is one among many choices. The
>conventional way to do this is to, of course, use an array. I was wondering
>if anything quicker was possible. (Why do I get the feeling that I am asking
>for too much!)
>
>Many thanks.
>Vince
>"Doug Robbins" <dkr@NOmvpsSPAM.org> wrote in message
>news:%23eKJW4gdEHA.4004@TK2MSFTNGP10.phx.gbl...
>> If you could come up with a wildcard string that is met by both "A" and
>"B"
>> and nothing else, it could be done.
>>
>> For A and B themselves, it would be [AB]{1} But I guess that is not
>really
>> what you meant.
>>
>> --
>> Please respond to the Newsgroup for the benefit of others who may be
>> interested. Questions sent directly to me will only be answered on a
>paid
>> consulting basis.
>>
>> Hope this helps,
>> Doug Robbins - Word MVP
>> "fdde" <sdsad@fsd.com> wrote in message
>> news:uQHXiDfdEHA.1048@tk2msftngp13.phx.gbl...
>> > Hi all,
>> >
>> > I would like to know if it is possible to search for more than 1 text
>> > using
>> > find. I mean something like, Selection.find.execute findtext:="A" or "B"
>> > and
>> > so on...
>> > I know I could use an array to do the search for each findtext string,
>but
>> > something like this would make my life easy! Please let me know.
>> >
>> > Thanks a lot.
>> >
>> > Vince
>> >
>> >
>>
>>
>


Re: Using OR condition in findtext by fdde

fdde
Sun Aug 01 20:46:29 CDT 2004

Hey Jay,

Thank you for your reply. Well, I guess Arrays .... Here I come!

Vince

"Jay Freedman" <jay.freedman@verizon.net> wrote in message
news:ictgg09lenp4to8pmtr5q4cor84of5rm0m@4ax.com...
> Hi Vince,
>
> Sorry, you are asking more than VBA can deliver. The standard way to
> do this is to loop through the array (of either find text or styles or
> any other criteria) and do a separate find for each. There is no
> quicker way except the wildcard search that Doug mentioned.
>
> Jonathan West suggested a speedup that will work with text (but not
> styles): pull the entire text of the document into a huge string, and
> use InStr() to test whether the current item in the array occurs
> anywhere in that string. If so, use .Find to locate the item in the
> document; if not, go on to test the next item.
>
> --
> Regards,
> Jay Freedman http://aspnet2.com/mvp.ashx?JayFreedman
> Microsoft Word MVP FAQ: http://www.mvps.org/word
>
> "fdde" <sdsad@fsd.com> wrote:
>
> >Thank you for your reply. I guess I will have to stick to the array
method
> >then. "AB" holds good only for single letter characters. It doesn't work
> >very well for super large strings. Also, is it possible to find any style
> >from a list of Styles using a range? I mean, can I have something like
> >Selection.find.style = "blah" or "blah" or "blah". Basically, I need to
> >change the text around if the style is one among many choices. The
> >conventional way to do this is to, of course, use an array. I was
wondering
> >if anything quicker was possible. (Why do I get the feeling that I am
asking
> >for too much!)
> >
> >Many thanks.
> >Vince
> >"Doug Robbins" <dkr@NOmvpsSPAM.org> wrote in message
> >news:%23eKJW4gdEHA.4004@TK2MSFTNGP10.phx.gbl...
> >> If you could come up with a wildcard string that is met by both "A" and
> >"B"
> >> and nothing else, it could be done.
> >>
> >> For A and B themselves, it would be [AB]{1} But I guess that is not
> >really
> >> what you meant.
> >>
> >> --
> >> Please respond to the Newsgroup for the benefit of others who may be
> >> interested. Questions sent directly to me will only be answered on a
> >paid
> >> consulting basis.
> >>
> >> Hope this helps,
> >> Doug Robbins - Word MVP
> >> "fdde" <sdsad@fsd.com> wrote in message
> >> news:uQHXiDfdEHA.1048@tk2msftngp13.phx.gbl...
> >> > Hi all,
> >> >
> >> > I would like to know if it is possible to search for more than 1 text
> >> > using
> >> > find. I mean something like, Selection.find.execute findtext:="A" or
"B"
> >> > and
> >> > so on...
> >> > I know I could use an array to do the search for each findtext
string,
> >but
> >> > something like this would make my life easy! Please let me know.
> >> >
> >> > Thanks a lot.
> >> >
> >> > Vince
> >> >
> >> >
> >>
> >>
> >
>