[RESOLVED] Testing for an Object that is not added as a component or reference
Is there any way to test for any object even if it is not added as a component?
Here's the problem. I want to have code that can handle a few known objects such a TreeView, SSTab and a few others. Now I want the code to be independent of these object it is to test for. Meaning there are no references to it. Is there a dynamic way to see if an object passed to a routine is the type of object you are looking for in this manner.
IE.
If TypeOf ctl is TreeView then ...
What I want is
If TypeOf ctl is (A dynamic object treeview representation) then ...
Re: Testing for an Object that is not added as a component or reference
Can you use TypeName instead of TypeOf ?
vb Code:
Option Explicit
Private Sub Command1_Click()
Dim obj As Object
Set obj = CreateObject("InternetExplorer.Application")
If TypeName(obj) = "IWebBrowser2" Then
obj.Visible = True
obj.Navigate "http://www.google.com"
End If
End Sub
Re: Testing for an Object that is not added as a component or reference
There's a thought... I will look into that.
Re: Testing for an Object that is not added as a component or reference
Works just fine... Thanks