I have a TreeView in excel 2007 with checkboxes.
- I want the checkboxes to be all selected when the tree is populated
 - I want that when I select/unselect a parent node of the list, all its children are selected/unselected
 
Here is the code I have written so far:
Private Sub UserForm_Initialize()
 'Set control defaults
 With Me
      .CommandButton1.Caption = "Close"
      .Label1 = vbNullString
      .ZonesTree.LineStyle = tvwRootLines
 End With
 'Populate the Treeview
 Call TreeView_Populate
End Sub
Private Sub TreeView_Populate()
Dim wbBook As Workbook
Dim wsZones As Worksheet
Dim rngZones As Range
Dim rngCinemas As Range
Dim lngRows As Long
Set wbBook = ThisWorkbook
Set wsZones = wbBook.Worksheets("Cinemas")
'lngRows = wsZones.Range("A65536").End(xlUp).row
lngRows = wsZones.UsedRange.Rows.Count
Set rngZones = wsZones.Range("A1:A" & lngRows)
Dim rngBC As Range
Set rngBC = wsZones.Range("B1:C" & lngRows)
Dim rCell As Range
Dim lastCreatedKey As String
Dim rowCount As Integer
Dim currentRowRange As Range
rowCount = 1
lastCreatedKey = ""
With Me.ZonesTree.Nodes
      'Clear TreeView control
      .Clear
        For Each rCell In rngZones
            If Not rCell.Text = "" Then
                .Add Key:=rCell.Text, Text:=rCell.Text
                lastCreatedKey = rCell.Text
            Else
                Set currentRowRange = rngBC.Rows(rowCount)
                .Add Relative:=lastCreatedKey, relationship:=tvwChild, Key:=currentRowRange.Cells(, 2).Text, Text:=currentRowRange.Cells(, 1).Text
            End If
            rowCount = rowCount + 1
        Next rCell
End With
End Sub
Private Sub Treeview1_NodeClick(ByVal Node As MSComctlLib.Node)
 Me.Label1.Caption = Node.Key
End Sub
Private Sub CommandButton1_Click()
 Unload Me
End Sub
This tree picks data from a sheet in this manner:
---A---------B---------C---------D
ParentNode
------------ChildNode
------------ChildNode
------------ChildNode
ParentNode
------------ChildNode
------------ChildNode
ParentNode
------------ChildNode
etc... (you get the idea, its an excel sheet...)
What is the vba code to select/unselect the boxes?? I have been searching a lot and couldn't find an answer to this easy problem....
Thx in advance!