Case Like "**" in VBA

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

Scott

I parse an XML response in VBA XP and I want to define what text is included
in the ObjectNode so wanted to create a Select Case statement that should
tell me if certain text is included in the ObjectNode, But I try to define
just a partial of the text like if the text is "Professional Services" I
would say

Case Like "*Professional *"

But I tried to do so in code but it didn't matched the case when the text
was "Professional Services"

Any help is appreciated.

Thanks

Scott
 
Scott said:
I parse an XML response in VBA XP and I want to define what text is
included in the ObjectNode so wanted to create a Select Case
statement that should tell me if certain text is included in the
ObjectNode, But I try to define just a partial of the text like if
the text is "Professional Services" I would say

Case Like "*Professional *"

But I tried to do so in code but it didn't matched the case when the
text was "Professional Services"

Any help is appreciated.

As the help file entry for Select Case states, the Like operator can't
be used as the comparison operator in a Select Case statement. Your
statement shouldn't even compile. However, you can work around it using
a structure like this:

Select Case True
Case ObjectNode Like "*Professional *"
' do something ...
' <other cases ...>
Case Else
' catch-all
End Select
 
Thanks Dirk, worked perfect;

I have had about 7 Cases with Microsoft PSS related to Access 2000 - XP of
which some were paid and some were under warranty, and I was always very
satisfied with their knowledge and experience with their own products; they
never closed a case without having me fully satisfied; But I could say at
some point that the help I receive from the Access NG is more efficient just
because you get advise from several experts in the field, and sometimes from
Microsoft PSS professionals as well.

Sometimes free support is better than paid...

Don't forget that without Microsoft's PSS group, people wouldn't have the
experience they have...

Thanks again,

Scott
 
Back
Top