Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA croaks on Nodes.Clear if TreeView is *not* Visible.
This just cost me days of effort, so I will share it with you:
In my Excel 2002 VBA 6.3, you must set TreeView.Visible = True if you wish to clear the tree and start over. If you don't, sick things happen. First of all, on immediate startup of a UserForm with a TreeView: Nodes.Clear has no adverse effect. (Maybe because since the tree is empty, it’s not doing anything). Moreover, these work unconditionally too: - Nodes.Add - Nodes.Remove(i) But there endeth the joy ride. If you wish to wipe the tree's nodes, then, if TreeView.Visible = False: Remove(i) seems severely bugged: - It executes but does nothing. It does NOT remove its node. - No error is thrown. You’re left completely in the dark why Nodes.Count didn’t change. Clear may or may not work, but it’s useless anyway. Because if you do it, then: The first .Add thereafter throws unhandled runtime error “Method Add of object INodes failed”. (What’s an INode, some Windows Interface thingy?) *But*, the bottom-line news isn’t bad. How long does a Clear take, anyway? A fraction of a second? Because on the very next line after .Clear, you can hide the tree again, and start adding new nodes without the user seeing your stupid screen churn. Actually, I misspoke. I have found that, seemingly amazingly, adding nodes does NOT seem to update the tree visually. But removing nodes does. So I hope I can help someone avoid the pain I just went thru. *** By the way, is using TreeViews tantamount to speaking Hittite? Will someone tell me why, when I use Google Groups’ (to me totally perverse, unworkable interface to) microsoft.public.excel.programming, I see only ONE instance of term “INodes” in a ¼ million submissions? I mean, huh? And--you guessed it--that one mention is mine, from last May. For which I thank Norman Jones for replying. *** |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
TreeView Control V - 6.0 - Drag-Drop Nodes | Excel Programming | |||
Returning checked Nodes from Treeview form control | Excel Programming | |||
Adding nodes to treeview | Excel Programming | |||
treeview add nodes | Excel Programming | |||
TreeView: add more than one node to nodes collection | Excel Programming |