LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default Treeview - Expand all parents of node

Hi All

I have a userform with a treeview of an account hierachy. What l am
trying to achieve with the code snippet below is find a node (in this
case with Key = "ADMIN PAY") and then expand all the parent nodes. The
code below works in that it finds the target node and expands that and
the immediate parent but does not go to the next level.

A further complication is that the node to be found can be at any
level between 2 to 7 and all parent nodes above that should be
expanded.

Any help to overcome this problem will be graetly appreciated


Private Sub CommandButton2_Click()

Dim branch As Variant
Dim ToFind As Variant

ToFind = "ADMIN PAY"

With UserForm1.TreeView1
For Each branch In .Nodes
If branch.Key = ToFind Then
branch.Expanded = True
branch.Parent.Expanded = True
End If
Next
End With

End Sub

Regards

Michael
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
moving treeview node Ernst Excel Programming 0 October 28th 08 06:17 PM
treeview node tag hold array? RB Smissaert Excel Programming 5 June 27th 05 12:32 AM
delete a node in treeview mark Excel Programming 1 May 15th 05 04:10 AM
How to add a sub-node of a treeview control JohnDing[_2_] Excel Programming 1 December 20th 04 09:30 AM
TreeView: add more than one node to nodes collection Peter[_25_] Excel Programming 3 September 5th 03 12:15 PM


All times are GMT +1. The time now is 10:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"