Основы офисного программирования и язык VBA


Пример 8.1


Public Sub LikeOperation()

Const pat1 = "[A-Z]"

Const pat2 = "[a-z]"

Const pat3 = "[!a-z]"

Const pat4 = "[3-5]"

Dim res As Byte

Dim Sym As String

res = "Кук" Like "К[аоу]к"

Debug.Print res

res = "f" Like pat1

Debug.Print res

res = "f" Like pat2

Debug.Print res

res = "f" Like pat3

Debug.Print res

res = "5" Like pat4

Debug.Print res

Sym = "3"

res = Sym Like pat1 & pat4

Debug.Print res

res = Sym Like pat1 Or Sym Like pat4

Debug.Print res

End Sub




Начало  Назад  Вперед



Книжный магазин