1

In VBA (for Word), I am trying to test the beginning of a string for roman numerals.

The following code works (e.g., to test whether the string "Mystr" contains the roman numeral "I"):

If Mystr Like "[A-Z]" Then 
.Style = "Heading 1" End If

The following code does not work (e.g., to test whether Mystr contains the roman numeral "II" or "III"):

If Mystr Like "[A-Z]{1,2,3}" Then
.Style = "Heading 1" End If

Does "Like" not accept curly brackets? If not, how could I achieve the same result?

Thank you.

4

0 回答 0