Solved

How to use a TreeView control in VBA

Posted on 2004-04-20
5
694 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
My experience with Windows 10 over a one year period and suggestions for smooth operation
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

805 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