View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_3_] Jim Thomlinson[_3_] is offline
external usenet poster
 
Posts: 983
Default Adding nodes to treeview

You will need to add a Treeview Control to the Toolbox.

Tools - Additional Controls - Microsoft Treeview Control

I haven't used the treeview in VBA but it should be similar to VB6

Hope this Helps...

"John" wrote:

How do you add nodes to a treeview control using VBA for Excel?

I've tried the code for VB6

TreeView1.Nodes.Add "MyFirstNode", tvwChild, ,"MyChildNode"

But it is telling me that tvwChild is not declared...

In Excel VBA the quick help for the Add method shows the arguments:
[relative],[relationship],[key],[text],[image],[selectedimage]

but I can't find any documentation as to what syntax to use for these
arguments.

Does anyone know what the syntax for these arguments is for Excel 2002 VBA?
Also, do I need to set a reference to something?

Thanks,
John