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
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,213,491
Messages
6,113,963
Members
448,536
Latest member
CantExcel123

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top