PDA

View Full Version : Strange Error When passing Treeview to sub



slowchaos
02-16-2021, 02:08 PM
I'm having an issue that I don't understand (obviously). I am passing a Microsoft Common Controls library object to a subroutine. I have done this before without issue. However, I am now getting an error that "Object does not support this property or method." I'm not trying to access any properties or methods. I'm passing the entire object as I always have.

Here are the details:

Declaration:

Dim tv As MSComctlLib.treeView
Set tv = Me.tvObjectProperties.Object

The offending line:

RightClickNode(tv)

And the declaration for the sub:

RightClickNode(tv as MSComctlLib.treeView)

What am I missing here?

--------------------------------------------------------------

Never mind. I found it. Someone had copy the code from another module and placed it in the form module. You can't pass form objects as arguments with the same form.

Gasman
02-17-2021, 06:58 AM
Perhaps mark it as Solved then?