Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   instr function (http://www.outlookbanter.com/outlook-vba/100686-instr-function.html)

Joel Allen March 4th 10 09:07 PM

instr function
 
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



Salad March 5th 10 12:11 AM

instr function
 
Joel Allen wrote:

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.



All times are GMT +1. The time now is 11:35 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com