Link to home
Start Free TrialLog in
Avatar of Roger
RogerFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Excel VBA solution to identify expanded Nodes in a UserForm TreeView

I have a TreeView control (Treeview1) displayed in excel.UserForm using classic vba.

I wish to return the oNode.text values of those TreeView nodes that are Expanded (not collapsed)
Do I have to detect each node 'expansion' event as it occurs and, for each, write TreeView1.SelectedItem.key to a worksheet,
Or:
Could I enumerate the TreeView as follows?

dim oNode as Node
for each oNode in Treeview1.NodeS
      ... and return to my worksheet the node.key value of each node that is expanded?
next

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Roger

ASKER

Many thanks!
Kelvin
You’re welcome and I’m glad I was able to help.

If you expand the “Full Biography” section of my profile you’ll find links to some articles I’ve written that may interest you.

Marty - Microsoft MVP 2009 to 2017
              Experts Exchange Most Valuable Expert (MVE) 2015, 2017
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2017
              Experts Exchange Top Expert VBA (current)