VBA/Excel/Access/Word/Data Type/IS

Материал из VB Эксперт
Перейти к: навигация, поиск

Is operator

 
Sub obtest()
  Dim a, b
  Set a = Sheets(1)
  Set b = Sheets(1)
  If a Is b Then
    Debug.Print "Is works correctly; a and b reference the same object"
  Else
    Debug.Print "Is doesn"t work."
  End If
  Debug.Print TypeName(a), TypeName(b)  "returns "Sheet"
  Debug.Print a.Name, b.Name            "returns the sheet name
End Sub