Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi Richard!
I tried the multiselection listbox. In my worksheet it uses a vector of options that is not always the same lenght. I found a way to tefresh the listbox when I chage the vector, using fRefresh variable. I still get an error when the vector is shorter than the previous.
I solved it changing the following sub
Sub MSlistbox_Change
If InitFlag<>1 Then
For i = 0 to UBound(Output)
If MSlistbox.Selected(i) = True Then
Output(i) = 1
` Else
Output(i) = 0
End If
Next
MSlistboxEvent.Recalculate()
End If
End Sub
in
Sub MSlistbox_Change
If InitFlag<>1 Then
MSlistboxEvent.Recalculate()
End If
End Sub
now it works... but I still don't undertand how it can work since I think I removed the part giving out the selection result.
However, if you would like to check it and include it in your code, I think this can be useful in the future for the community.
Thanks, Loris
I posted a fixed version of the listbox here:
http://communities.ptc.com/message/165816#165816
I also added it to a new version of the "Extra Components" document. That should handle your variable length vectors OK.