(I'm using VBA with Excel 2003, have references to OLE Automation and Microsoft Common Controls 6.0). The Hittest with my Treeview control does not seem to be working. I'm using it in a MouseDown event. The X and Y coordinates are being passed properly and are the correct values, but every time the node is always set to the top one, regardless of where I click on the Treeview window (yes I have more than one node). Code Below:

Private Sub TreeView1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As stdole.OLE_XPOS_PIXELS, ByVal Y As stdole.OLE_YPOS_PIXELS)

Set dragNode = TreeView1.HitTest(X, Y)

End Sub

No matter where I click, even though X and Y change, dragNode always set to first node.

Disregard the extra 'Integer' declaration in my first post ... not sure how that got in there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.