If Statement With Wildcard Not Working
Hi, I have entered the below IF statement to make a textbox display a value based on a field.
If the field starts with GB the box should display Made in GB, if CZ Made in CZ, anything else Error.
However it doesn't work and I can't find any proper information on what wildcard to use for numbers only.
If I enter a whole serial number it works fine.
If Format.NamedSubStrings("Serial").Value ="GB********" Then
value = "Made in GB"
Elseif Format.NamedSubStrings("Serial").Value ="CZ********" Then
value = "Made in CZ"
Else
value = "Serial error"
End If
Any ideas? Thank you for reading.
-
Shotaro Ito
★ BarTender Hero ★
VB Script doesn't have wildcard in IF statement, unlike VBA.
for "begins with" condition, just take 2 characters like
If Left(Format.NamedSubStrings("Serial").Value,2) = "GB" Then...Besides you can use Regular Expression object for wildcard and more flexible matching - see below.
http://stackoverflow.com/questions/16682155/vbs-compare-strings-using-wildcard
0 -
VB Script doesn't have wildcard in IF statement, unlike VBA.
for "begins with" condition, just take 2 characters like
If Left(Format.NamedSubStrings("Serial").Value,2) = "GB" Then...Besides you can use Regular Expression object for wildcard and more flexible matching - see below.
http://stackoverflow.com/questions/16682155/vbs-compare-strings-using-wildcard
Thank you, works perfectly using begins with.
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
2 Kommentare