String1 ="text"

String2 ="text"

String3 ="text"

String4 ="text"

String5 ="text"

if String1 and String2 and string3 and string4 and string5 = "text" then

msgbox "equal"

else

msgbox "not equal"

end if

The above syntax does not work well. do you have any other way to compare multiple strings?

Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

2

Hi

to compare multiple string :-

take an array

a=Array("text","text","text","text","monday","sunday")

b=Filter(a,"")

for each x in b

if strcomp(x,"test",vbTextCompare) = 0 then

msgbox "Equal"

else

Msgbox "Not equal"

End if

Next

 

hope this help..

 

 

Answered 03/06/2014 by: shreyas
Senior White Belt

  • This syntax worked.. Thanks a lot :)
Please log in to comment

Answers

0

have you tried something like:

if String1 = String2 = string3 = string4 = string5 = "text" then 

....

End if


Should work fine.

 Regards,

 Marco - StockTrader

Answered 03/06/2014 by: StockTrader
Red Belt

Please log in to comment
0

you can use StrComp function in VBScript

Answered 03/07/2014 by: SilentKiller
Orange Belt

  • StrComp function works only to compare 2 strings.
Please log in to comment
Answer this question or Comment on this question for clarity