fionabolt
09-19-2007, 05:04 AM
I am trying to create a multi column list box that is populated with an array. I would like the first items of the array to appear as the column headings. However, my code is not doing what I would expect.
What am I doing wrong?
First I have created my array, for examples sake:
Dim myArray(3, 3)
myArray(0, 0) = "Heading 1"
myArray(0, 1) = "Heading 2"
myArray(0, 2) = "Heading 3"
myArray(1, 0) = "Name1"
myArray(1, 1) = "Tel1"
myArray(1, 2) = "Location1"
myArray(2, 0) = "name2"
myArray(2, 1) = "Tel2"
myArray(2, 2) = "Location2"
Then, say, in my userform I have a listbox called lstConsultant.
So, this populates my list box:
With Me.lstConsultant
.Clear
.ColumnCount = 3
.List() = myArray
End With
But I would expect this:
me.lstConsultant.ColumnHeads = True
to put the first item of the array into the headings. However, it does nothing, except create an empty heading area.
What am I missing?
Thanks
What am I doing wrong?
First I have created my array, for examples sake:
Dim myArray(3, 3)
myArray(0, 0) = "Heading 1"
myArray(0, 1) = "Heading 2"
myArray(0, 2) = "Heading 3"
myArray(1, 0) = "Name1"
myArray(1, 1) = "Tel1"
myArray(1, 2) = "Location1"
myArray(2, 0) = "name2"
myArray(2, 1) = "Tel2"
myArray(2, 2) = "Location2"
Then, say, in my userform I have a listbox called lstConsultant.
So, this populates my list box:
With Me.lstConsultant
.Clear
.ColumnCount = 3
.List() = myArray
End With
But I would expect this:
me.lstConsultant.ColumnHeads = True
to put the first item of the array into the headings. However, it does nothing, except create an empty heading area.
What am I missing?
Thanks