Select Case Text includes ...

  • Thread starter Thread starter Scott
  • Start date Start date
S

Scott

I have a Select Case in my code where I check if certain text matches the
case, now I want to know if the case *includes* the text mentioned in there,
even if it includes other text also, and that's different than a regular
Select case where I would write:

Select Case TextContant
Case "This one exactly"
Do This
Case "This one exactly 3"
Do something other
End Select

But in my case I want to have 1 case if the text contains "This one exactly"
even if it has more text before or after that, how do I do that. ?


Thanks,

Scott
 
I used a slightly different method, but maybe it will work
for you? I used the instr function to compare strings.

Public Function this_Exact(strText As String) As Boolean

Dim intMatch As Integer

intMatch = InStr(strText, "This one exactly")

If intMatch > 0 Then
this_Exact = True
Else
this_Exact = False
End If


End Function
 
Back
Top