View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] baobob@my-deja.com is offline
external usenet poster
 
Posts: 100
Default "Method 'Add' of object 'INodes' failed" in TreeView.

I have a TreeView on a UserForm, and a load/reload button.

When the form comes up, the user can click the button which loads the
tree. He can click the button later too, which clears and reloads the
tree. The code for both first and subsequent loads is:

TreeView1.Nodes.Clear
Set MyRoot = TreeView1.Nodes.Add(Text:="The root")
AddManyMoreNodesUnder(MyRoot)
....etc.

Until today, it worked fine every time. I must've done something to
break it.

Now, adding the first (root) node to the tree works once, but on
clearing the tree and doing it again it fails on the Nodes.Add line:

Run-time error '-2147417848 (80010108)'
Method 'Add' of object 'INodes' failed

In the watch window, all properties of TreeView seem to have the same
state both times. Nor is there a problem with TreeView.Nodes--it
exists and count is 0 both times.

I can't think of what else to compare or diagnose.

Anyone?

Thanks.

***