Solved

How to use a TreeView control in VBA

Posted on 2004-04-20
5
706 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

749 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