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: 100
Default 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
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
TreeView Control V - 6.0 - Drag-Drop Nodes mecg96 Excel Programming 6 March 8th 08 08:34 PM
Returning checked Nodes from Treeview form control Dan Thompson Excel Programming 1 December 14th 04 08:33 AM
Adding nodes to treeview John Excel Programming 3 December 1st 04 09:07 PM
treeview add nodes Serkan[_2_] Excel Programming 3 October 3rd 03 09:55 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:35 AM.

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

About Us

"It's about Microsoft Excel"