"Method 'Add' of object 'INodes' failed" in TreeView.

B

baobob

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.

***
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top