Possible Duplicate:
Adding items in a Listbox with multiple columns
With MFC VC++ there are two controls, ListBox
and ListCtrl
. But with VBA it seems we have only ListBox
.
I want to create a listbox with 2 columns (Company_ID, Company_Name).
Here is what I tried:
- I created lstbox(control type ListBox)
- Row source type = value list
- I am taking value from user from two edit boxes and when user clicks "add" then it should be added to the listbox with 2 columns.
In the VBA code routine I added the following lines:
lstbox.ColumnCount = 2
lstbox.AddItem (Company_ID)
The following code is not working which seems to be related with adding column value:
lstbox.Column(1,lstbox.ListCount - 1) = Company_name
This gives error:
Runtime error '424' object required.
Could anyone help with vba code to add to multi column listbox.