0
我想從ComboBox中獲取數據,您可以在其中選擇多個數據。VBA從組合框中獲取多個數據
我的代碼如下:
Dim ind As Integer
Dim bl As Boolean
ind = 0
While ind < Forms!Rec!CONTACT.ListCount
bl = Forms!Rec!CONTACT.Selected(ind)
If bl Then
txt1 = txt1 + "Contact : " & Forms!Rec!CONTACT.Column(4, ind) & " " & Forms!Rec!CONTACT.Column(2, ind) & vbCrLf & Forms!Rec!CONTACT.Column(3, ind) & vbCrLf & Forms!Rec!CONTACT.Column(6, ind)
End If
ind = ind + 1
Wend
出於某種原因,布爾值始終爲false。
任何想法?
在此先感謝
以上代碼位於何處?這個代碼執行時,表單是否仍然被加載? –
我剛剛意識到我打算打招呼...... 該代碼位於另一個代碼中,旨在從表單中的數據生成一個powerpoint。當我運行代碼時,表單仍然是打開的。 – Guillaume1077
我認爲你只能在一個ComboBox中選擇一個項目。您可能想要使用ListBox來代替。 –