?
Solved

How can I check if a String contains another String using VBA 6.0?

Posted on 2008-06-19
3
Medium Priority
?
1,162 Views
Last Modified: 2010-08-05
How can I do a check to see if String 'x' contains String 'y' anywhere within using VBA 6.0?
0
Comment
Question by:MaineBiotech
  • 2
3 Comments
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 200 total points
ID: 21822864
If InStr(1, StringX, StringY) > 0 Then
    'contains
Else
    'does not contain
End If
0
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 21822885
MaineBiotech,

The 1 is not fixed; use it to force what position to start the search at.  There is also an optional argument
for which text comparison mode to use.  See the help file for more details.

Regards,

Patrick
0
 

Author Closing Comment

by:MaineBiotech
ID: 31468819
Perfect, thank you very much!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Six Sigma Control Plans

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question