![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hello,
I'm trying to make an if statement that finds a part of the value. For example: If Item.UserProperties("test") = "Apple", my if statement could find the "ppl" in it regardless of case sensitivity. if Item.UserProperties("test") has "ppl" in it, then...... Hope that make sense, thanks, Joel |
Ads |
#2
|
|||
|
|||
![]()
The function you're looking for is Instr():
myString = Item.UserProperties("test") If Instr(1, myString, "ppl", vbTextCompare) 0 Then MsgBox "myString contains ppl" End If -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Joel Allen" wrote in message ... Hello, I'm trying to make an if statement that finds a part of the value. For example: If Item.UserProperties("test") = "Apple", my if statement could find the "ppl" in it regardless of case sensitivity. if Item.UserProperties("test") has "ppl" in it, then...... Hope that make sense, thanks, Joel |
#3
|
|||
|
|||
![]()
Thanks. What if I wanted to search for multiple items? I want search for
tbd, N30, etc.... This is not working. Instr(1, Item.UserProperties("PaymentTerms"), "tbd", "N30", "etc....", vbTextCompare) 0 Thanks for your help. I tried to go to VB help, but there's no documentation about this. Do you have a good reference for syntax questions like this so I don't have to keep bugging you? "Sue Mosher [MVP]" wrote in message ... The function you're looking for is Instr(): myString = Item.UserProperties("test") If Instr(1, myString, "ppl", vbTextCompare) 0 Then MsgBox "myString contains ppl" End If -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Joel Allen" wrote in message ... Hello, I'm trying to make an if statement that finds a part of the value. For example: If Item.UserProperties("test") = "Apple", my if statement could find the "ppl" in it regardless of case sensitivity. if Item.UserProperties("test") has "ppl" in it, then...... Hope that make sense, thanks, Joel |
#4
|
|||
|
|||
![]()
You'd need to repeat the Instr() statement for each string you want to
search for. An array might be handy for managing the different search strings. You can easily look up the syntax for Instr() by typing it into your code module, putting the cursor on it, and then pressing F1. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Joel Allen" wrote in message ... Thanks. What if I wanted to search for multiple items? I want search for tbd, N30, etc.... This is not working. Instr(1, Item.UserProperties("PaymentTerms"), "tbd", "N30", "etc....", vbTextCompare) 0 Thanks for your help. I tried to go to VB help, but there's no documentation about this. Do you have a good reference for syntax questions like this so I don't have to keep bugging you? "Sue Mosher [MVP]" wrote in message ... The function you're looking for is Instr(): myString = Item.UserProperties("test") If Instr(1, myString, "ppl", vbTextCompare) 0 Then MsgBox "myString contains ppl" End If "Joel Allen" wrote in message ... Hello, I'm trying to make an if statement that finds a part of the value. For example: If Item.UserProperties("test") = "Apple", my if statement could find the "ppl" in it regardless of case sensitivity. if Item.UserProperties("test") has "ppl" in it, then...... Hope that make sense, thanks, Joel |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Iif statement on mail form | Sandi V | Outlook - Using Forms | 1 | November 17th 08 10:00 PM |
Word Macro Conditional Statement | hometeamjill | Outlook and VBA | 1 | March 24th 08 12:59 PM |
If then statement | Aggie G | Outlook - Using Forms | 3 | February 2nd 07 07:50 PM |