With Me
Treview1.Nodes.Add(blah blah blah)
end with
but when I add the nodes and run the control on my form nothing happens
I know that this control can be used in a Excel VBA form.
Im just not sure how to get it going has anyone used this control on a Excel
VBA form before that can help me with a small working sample ?
Thanks Dan Thompson
"Tom Ogilvy" wrote:
> http://support.microsoft.com/default.aspx?scid=kb;en-us;244954
> How To Populate a Treeview Control with an XML File
>
> The treeview control is not distributed with microsoft office, so you
> wouldn't expect to find anything about it in the help files for excel.
>
> --
> Regards,
> Tom Ogilvy
>
> "Dan Thompson" <DanTh...@discussions.microsoft.com> wrote in message
> news:36107946-73DA-41C2...@microsoft.com...
> > Hi there I am extreamly frustrated because I have recently discoverd the
> > treeview control but am unable to use it. I have found nothing in the
> Excel
> > VBA help files of use and every search I have done for a example code has
> > been either far to complex or had errors in in it before I edited
> anything.
> > Could someone please help me with a small very very very basic example
> code
> > for populating and using the Treeview control on a vba form.
> >
> > Thanks, Dan
> >
>
>
>
Short explanation of the Blah blah part:
Nodes.Add(Key of parent node, relation to parent node, unique node key, node
text, optional icon to display)
Private Sub UserForm_Initialize()
Dim L1 As Long, L2 As Long
With Me.TreeView1
Dim NodX As Node
Set NodX = .Nodes.Add(, , "Root", "My main node")
Set NodX = Nothing
For L1 = 1 To 6
Set NodX = .Nodes.Add("Root", tvwChild, _
"Sub" & L1, "Child " & L1)
NodX.EnsureVisible
Set NodX = Nothing
For L2 = 1 To 12
Set NodX = .Nodes.Add("Sub" & L1, tvwChild, _
"Sub" & L1 & "sub" & L2, "Grandhild " & L1)
Set NodX = Nothing
Next
Next
End With
End Sub
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
If Node.Key = "Root" Then
MsgBox "I'm root."
Else
MsgBox "You just clicked " & Node.Key & ", proud child of the great " &
_
Node.Parent.Key
End If
End Sub
HTH. Best wishes Harald
"Dan Thompson" <DanTh...@discussions.microsoft.com> skrev i melding
news:FA061EDF-AF70-482B...@microsoft.com...
Dan
Glad to hear that Dan. Thanks for the feedback.
Best wishes Harald