MS Word String Validation using a Mask RRS feed

  • General discussion

  • I'm a novice an would like to know what other code needs to go between

    Private Sub TextBox1_Change()


    End Sub

    in order to use this answer given some time back.

        If strText Like "[A-Z][0-9][0-9][0-9][A-Z]" Then
    End If

    Thanks very much

    Monday, March 3, 2014 1:46 PM

All replies

  • It depends on what you are doing, but to test the value in TextBox1 you either need to copy it, e.g.

    Private Sub TextBox1_Change
    Dim strText as String
    strText = TextBox1.Value
    If strText Like "[A-Z]...

    or you need to test the value directly

    If TextBox1.Value Like "[A-Z]...

    Peter Jamieson

    Monday, March 3, 2014 2:40 PM
  • Thanks Peter. This is SO much simpler than some of the posts I've read.

    I sent another question though, but I think I did it on the wrong page.

    Being new, I'm not allowed to include the hyperlink. But basically it's the same page I used to ask this question.

    Thanks so much for being there.


    Tuesday, March 4, 2014 10:09 AM