ComboBox.ItemsSelected 屬性 (Access)ComboBox.ItemsSelected property (Access)

您可以使用 ItemsSelected 屬性可傳回隱藏 ItemsSelected 集合的唯讀參照。You can use the ItemsSelected property to return a read-only reference to the hidden ItemsSelected collection. 此隱藏的集合可用來存取 multiselect 下拉式方塊控制項所選列中的資料。This hidden collection can be used to access data in the selected rows of a multiselect combo box control.

語法Syntax

運算式ItemsSelectedexpression.ItemsSelected

_運算式_代表**ComboBox** 物件的變數。expression A variable that represents a ComboBox object.

註解Remarks

ItemsSelected 集合是與其他集合不同,因為它是的 變體 而不是物件的集合。The ItemsSelected collection is unlike other collections in that it is a collection of Variants rather than of objects. 每個 Variant 是一個整數索引參照清單方塊或下拉式方塊中選取的資料列。Each Variant is an integer index referring to a selected row in a list box or combo box.

擷取資料的清單方塊或下拉式方塊中選取的列與 屬性或 ItemData 屬性一起使用使用 ItemsSelected 集合。Use the ItemsSelected collection in conjunction with the Column property or the ItemData property to retrieve data from selected rows in a list box or combo box. 您可以在每個使用 列出 ItemsSelected 集合...]下一個 陳述式。You can list the ItemsSelected collection by using the For Each...Next statement.

例如,如果您有在表單上的 [員工] 清單方塊,您可以列出ItemsSelected集合,並使用控制項的ItemData屬性可傳回清單方塊中的每個選取列的繫結資料行的值。For example, if you have an Employees list box on a form, you can list the ItemsSelected collection and use the control's ItemData property to return the value of the bound column for each selected row in the list box.

ItemsSelected集合有兩個屬性、 CountItem屬性,並沒有方法。The ItemsSelected collection has two properties, the Count and Item properties, and no methods.

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.