Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Joel,
Many thanks for helping out on this. I was trying something like the loop you put in but just not get it to work. It didn't work exactly as posted but l made a couple of changes and got it working. I had to declare the variable NewBranch as Object and rather confusingly had to insert a On Error statement for the loop which errored out if NewBranch was nothing! Not sure l fully understand why the loop did not work properly and if you could throw any light on the subject l would gratefull as l dont like throwing On error statements into code willy nilly. Finally l want to select the 'ToFind' node. Any pointers to what the code segment looks like? Heres the code l ended up with: Private Sub CommandButton2_Click() 'Purpose: To find node Dim branch As Variant Dim ToFind As Variant Dim leaf As Variant Dim NewBranch As Object ToFind = "ADMIN NON-PAY" With UserForm1.TreeView1 For Each branch In .Nodes If branch.Key = ToFind Then branch.Expanded = True branch.Parent.Expanded = True On Error Resume Next Set NewBranch = branch Do While Not NewBranch Is Nothing Set NewBranch = NewBranch.Parent NewBranch.Expanded = True Loop On Error GoTo 0 End If Next End With Regards Michael |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
moving treeview node | Excel Programming | |||
treeview node tag hold array? | Excel Programming | |||
delete a node in treeview | Excel Programming | |||
How to add a sub-node of a treeview control | Excel Programming | |||
TreeView: add more than one node to nodes collection | Excel Programming |