View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] wisccal@googlemail.com is offline
external usenet poster
 
Posts: 51
Default Get only child nodes?

I'm not sure if this helps you, but theoretically what you want to do
is something like this:

Public Sub printChildNodes(ByVal n As Node) ' n is selected node
For Each Node in n.getChildNodes()
If Node.hasChildren() Then
printChildNodes(Node)
Else
Debug.Print Node
End If
Next Node
End Sub

Regards,
Steve

Satish wrote:

Hi all:

I am using a treeview control to display data that I have on a
spreadsheet. I looked around the internet for a solution to a problem
that I am facing, but could not find the answer that I want...

Is there any way I can get only the child nodes of a selected parent
node in a Treeview control in the order they are in the treeview?

I know there are many posts and solutions giving how to get the child
nodes, but somehow the logic always returns all the nodes at the
selected level too... for ex.

MSoffice:
+ Word
- Excel
- workbook
- worksheet
- VBA
- Temp
+ Powerpoint
+ Access

Here, if I select the node "Excel", I only want the child nodes of
Excel and any other child nodes of Excel's children. (hope this makes
sense). In short, I want workbook, worksheet, VBA and Temp (In this
order only). The solutions offered always return Powerpoint and Access
also. I dont want those.

I am not able to determine as to what condition I should check for so
that my program will filter out the unwanted nodes....probably it is
getting complex because all solutions use recursive calls.

If anyone can help, I will post the code that I currently have.

Thanks!
Satish