Dynamic ListView Control

switters_aka

Board Regular
Joined
Oct 26, 2010
Messages
118
Does anyone happen to know if it is possible to create ListView controls dynamically? Currently I am using listboxes to simulate what the listview report style offers and only just discovered the listview control last week. After a search on Google I concluded that, as the ListView doesn't seem to be an object under the MSForms parent, it isn't possible, but thought that maybe I was looking in the wrong place or asking the wrong question. Further to being able to produce the listview programmatically, I would also need to be able to assign events (click/dbl_click). I am currently achieving this for the listboxes using class modules.

If you have a solution to both, I would be delighted to hear from you. :)
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Yes, it is. Code would be something like:
Code:
    Me.Controls.Add bstrprogid:="MSComctlLib.ListViewCtrl", Name:="Listview1", Visible:=True
depending on where your control is being placed. You'd still use class modules and WithEvents variables for the event handling.
 
Upvote 0
Thank you RoryA. You saved me a lot of time. I'll probably be posting again for help on how to set up the class modules but I'll give it a go. Thanks again.
 
Upvote 0

Forum statistics

Threads
1,214,790
Messages
6,121,607
Members
449,037
Latest member
Arbind kumar

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