instr function

J

Joel Allen

Outlook 2003 SP3

Hi,

I'm trying to find * and ? in the string. Do I have to do two separate if
statements, or can I use some kind of OR statement? This isn't working:

If Instr(1, Item.UserProperties("JobName"), "*" or "?", vbTextCompare) > 0
Then

MsgBox "Sorry, you cannot use the * or ? character"

Exit Sub

end if



Thanks,
Joel
 
S

Salad

Joel said:
Outlook 2003 SP3

Hi,

I'm trying to find * and ? in the string. Do I have to do two separate if
statements, or can I use some kind of OR statement? This isn't working:

If Instr(1, Item.UserProperties("JobName"), "*" or "?", vbTextCompare) > 0
Then

MsgBox "Sorry, you cannot use the * or ? character"

Exit Sub

end if



Thanks,
Joel
x = "Joe Blow"
? (ubound(split(x,"*")) or ubound(split(x,"?"))) > 0 'False

x = "Joe*Blow"
? (ubound(split(x,"*")) or ubound(split(x,"?"))) > 0 'True

x = "Joe Blow?"
? (ubound(split(x,"*")) or ubound(split(x,"?"))) > 0 'True

x = "Joe*Blow?"
? (ubound(split(x,"*")) or ubound(split(x,"?"))) > 0 'True

Or you could use Instr() but 2 separate comparisons as well.
 

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