Example:

  1. Sub Main ()

    1. myStr = "Good Bye and Bye Again"

      myLoc1 = InStr(1, myStr, "Bye")          ' returns the position of the first occurrence

      myLoc2 = Instr(10, myStr, "Bye")          ' returns the position of the second occurrence

      MsgBox "Found string at location " & myLoc1 & ".", 64, "String Found"

      MsgBox "Found string at location " & myLoc2 & ".", 64, "String Found"

    End Sub