Solved

How to use a TreeView control in VBA

Posted on 2004-04-20
5
681 Views
Last Modified: 2012-05-04

 Just need simple instructions.
       I'm using Excel 2000 and have a form with a new TreeView control.
 In help it says to go to Properties window to Nodes, and add in Nodes.
      I don't see nodes in property window of the TreeView Control, though I see Sample Nodes
 on the Control itself.
      Anyhow, I need a VBA code to add few Parent lines and 5 child lines to each parent.

     Thanks.
0
Comment
Question by:LenkaL
  • 2
5 Comments
 
LVL 16

Accepted Solution

by:
sebastienm earned 50 total points
ID: 10872272
LenkaL,

from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cmctl198/html/vbpronodesx.asp
Say your treeview control is named tv1:

   With tv1
      With .Nodes
         .Add , , "R", "Root"
         .Add "R", tvwChild, "C1", "Child 1"
         .Add "R", tvwChild, "C2", "Child 2"
         .Add "R", tvwChild, "C3", "Child 3"
         .Add "R", tvwChild, "C4", "Child 4"
         tv1.Nodes(.Count).EnsureVisible
      End With
      .Style = tvwTreelinesText ' Style 4.
   End With

Other sources of code and doc, but maybe you have already looked at that:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cmctl198/html/vbpronodes.asp

Regards,
Sébastien
0
 

Author Comment

by:LenkaL
ID: 10882552

 Thanks,
 Will try it.
 
0
 
LVL 16

Expert Comment

by:sebastienm
ID: 12092762
Hi LenkaL,
This post has been open for quite a while.
Did the above comment helped you?

Regards,
Sebastien
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now