How to check if a variable exists within another variable

X

Xs4all

Hi,

I have 2 variables:

A="Fox"
B="The quick brown fox"

How can I check if variable B contains variable A? Something like: "IF (A is
part of B) THEN TRUE"

Is that possible in VBA?

Thanks
 
J

Jonathan West

Xs4all said:
Hi,

I have 2 variables:

A="Fox"
B="The quick brown fox"

How can I check if variable B contains variable A? Something like: "IF (A
is part of B) THEN TRUE"

Is that possible in VBA?

Thanks

Look up the InStr function in VBA Help. Also look up "Like", "LCase" and
"UCase". There are code examples in the Help which will point you in the
right direction.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

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