Listview add at run time with class module for event handling


Board Regular
Oct 26, 2010
I'm having problems deploying a vba project on PCs throughout my organisation due to differences in windows configurations (I think). I have checked that MSCOMCTL.ocx is available on each PC and the listview control is available in the form controls menu (tools). As a side note, when I tried to register the .ocx file it failed to do so saying the DLL file isn't in the library. It is possible to add the LV control to a userform created on the machines which won't accept the import: to be precise, the import doesn't fail, but the LV control doesn't load because it says the object failed to load - which is weird because the reference to common controls is set and the control exists in the tools menu. The form is there and every other control except the listview.

I felt that the solution to this might be to create the control at run time and use a class module to handle event but I have two problems with this:
1) I don't know how to do it and
2) I read this morning that even doing this might not solve the problem.

I would like to give it a try though to see if it does solve the problem and would like to request one of you kind folks to share with me a class module which will handle item and column click events and instructions on how to run it from a module.

If however there is another suggestion on how to reliably deploy projects with a listview or alternative, I would be delighted to hear about it.

Thanks in advance for any support.

Some videos you may like

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Watch MrExcel Video

Forum statistics

Latest member

This Week's Hot Topics