Hello all,

I would like to know if there's a way to pass a handle to an object as a parameter of another function in VB.
Below is an example:

public Function someFunction
Dim objTest as AnObject
set objTest = new AnObject.Something

' ... some code

' Now I will call another function that needs to have
' access to this object, so I pass it as a parameter
AnotherFunction objTest

' ... some more code

End Function

private Function anotherFunction(handleToObject as Variant)
' I can now use that variable as a handle to the
' object instantiated above to call its properties
handleToObject.someProperty

Exit Function
End Function



So, can we do something like that or I'll have to instantiate the object all over again in each function?
Please any help is greatly appreciated.
Thank you all in advance.

- Pascal