Zum Hauptinhalt gehen

Suche

Suche

If Statement With Wildcard Not Working

Kommentare

2 Kommentare

  • Avatar
    Shotaro Ito

    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
  • Avatar
    Legacy Poster

    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.