Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to use a TreeView control in VBA

Posted on 2004-04-20
5
Medium Priority
?
747 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 200 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

916 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