Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Adding nodes to treeview

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Adding nodes to treeview

Yeah I've already added the control to the tool box and to my userform.

You'd think it would be similar to VB6. I've tried using VB6 syntax but
I'm getting "variable not defined" errors.



"Jim Thomlinson" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Adding nodes to treeview

John,

Ensure that you have a reference (VBA Tools menu, References) set
to Microsoft Windows Common Controls.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"John" wrote in message
...
Yeah I've already added the control to the tool box and to my
userform.

You'd think it would be similar to VB6. I've tried using VB6
syntax but
I'm getting "variable not defined" errors.



"Jim Thomlinson" wrote:

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



Reply
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
Minimum route from two nodes stefantem[_4_] Excel Programming 2 September 28th 04 12:03 AM
Minimum route from two nodes stefantem[_6_] Excel Programming 1 September 24th 04 04:48 PM
Minimum route from two nodes stefantem[_5_] Excel Programming 0 September 24th 04 11:46 AM
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 09:31 PM.

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"