How can you obtain the Type (the name as a string is sufficient) of an Object in VB6 at runtime?
i.e. something like:
If Typeof(foobar) = 'CommandButton' Then ...
/EDIT: to clarify, I need to check on Dynamically Typed objects. An example:
Dim y As Object Set y = CreateObject('SomeType') Debug.Print( <The type name of> y)
Where the output would be ‘CommandButton’
I think what you are looking for is TypeName rather than TypeOf.
Edit: What do you mean Dynamic Objects? Do you mean objects created with CreateObject(”), cause that should still work.
Edit:
Outputs
Object Type: FileSystemObject