Multi-Column Treeview

Gettingbetter

Well-known Member
Joined
Oct 12, 2004
Messages
602
Hi Everyone,

Its been a while since Ive posted, but this one has proper stumped me.

Has anyone ever got the Multi-Column Treeview from Vbaccelerator working in VBA?

http://www.vbaccelerator.com/home/v...iew/Multi-Column_TreeView_Control/article.asp

Once you have referenced the ocx (which you download from the site) you can put the treeview onto your userform.

Adding nodes and doing all the stuff the normal treeview does, isnt a problem but when you try and add the extra columns, it becomes a knightmare!!

Heres some simple code to add some nodes
Code:
Private Sub UserForm_Initialize()
Me.vbalColumnTreeView1.Nodes.Add Key:="Node Main", Text:="Im a node"
Me.vbalColumnTreeView1.Nodes("Node Main").AddChildNode Key:="NodeUnder", Text:="Im under a node"
Me.vbalColumnTreeView1.Nodes("NodeUnder").AddChildNode Key:="NodeUnder2", Text:="Im under 2 nodes"
End Sub

However following the instructions to add columns seems impossible, I have tried a hundred variations of the below with no success
Code:
Dim cCol As cCTreeViewColumns
With Me.vbalColumnTreeView1
  With .Columns
    .Items(1).Width = 128
    Set cCol = .Add(Key:="TrackCol", Text:="Track")
    Set cCol = .Add("LENGTH", "Length")
    Set cCol = .Add("SIZE", "Size")
  End With
End With

It seems to me that
Code:
Me.vbalColumnTreeView1.Columns.Add Key:="P1", Text:="Column", Width:=128
Should work but it doesnt!

There are a few examples (not many) of other people asking this question on the web, but no one gets an answer.

If anyone fancies a try I will be very grateful.

PS, I know there is hundreds of other ways of making forms that look similar (eg using mixtures of imagelists, comboboxs, listboxes etc...) but I am only interested to see if anyone can make this ActiveX control to work. Its haunted me for hours that something thats seems simple is being so difficult ha ha :)

Cheers
GB
 

Some videos you may like

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Watch MrExcel Video

Forum statistics

Threads
1,118,929
Messages
5,575,084
Members
412,645
Latest member
pipe
Top