【发布时间】:2019-10-29 02:20:46
【问题描述】:
我想知道是否有一种简单的方法可以将 ListBox 中的所有选定项目存储到一个数组中。
我尝试使用以下代码执行此操作,但它没有工作除了例外。
FilterTest()什么都不给我。
Private Sub ListBox1_Change()
Dim FilterTest() As Variant
Dim myMsg As String
Dim i As Long
Dim Count As Integer
Count = 1
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
ReDim Preserve FilterTest(Count)
FilterTest(Count) = ListBox1.List(i)
Count = Count + 1
End If
Next i
End Sub
【问题讨论】: