Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- If Typeof(foobar) = "CommandButton" Then ...
- Dim y As Object
- Set y = CreateObject("SomeType")
- Debug.Print( <The type name of> y)
- If TypeName(foobar) = "CommandButton" Then
- DoSomething
- End If
- Private Sub Command1_Click()
- Dim oObject As Object
- Set oObject = CreateObject("Scripting.FileSystemObject")
- Debug.Print "Object Type: " & TypeName(oObject)
- End Sub
- Typename()
- Private Sub cmdCommand1_Click()
- Dim a As Variant
- Dim b As Variant
- Dim c As Object
- Dim d As Object
- Dim e As Boolean
- a = ""
- b = 3
- Set c = Me.cmdCommand1
- Set d = CreateObject("Project1.Class1")
- e = False
- Debug.Print TypeName(a)
- Debug.Print TypeName(b)
- Debug.Print TypeName(c)
- Debug.Print TypeName(d)
- Debug.Print TypeName(e)
- End Sub
- String
- Integer
- CommandButton
- Class1
- Boolean
Add Comment
Please, Sign In to add comment