Solved

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

Posted on 2008-06-19
3
1,125 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 92

Accepted Solution

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

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…

751 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