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

會傳回控制項的 屬性 集合物件的參照。Returns a reference to a control's Properties collection object. 唯讀。Read-only.

語法Syntax

運算式屬性expression.Properties

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

註解Remarks

Properties 集合物件是控制項相關的所有屬性的集合。The Properties collection object is the collection of all the properties related to a control. 您可以使用 member 物件的索引或是 member 物件名稱的字串運算式參照集合中的個別成員。You can refer to individual members of the collection by using the member object's index or a string expression that is the name of the member object.

集合中的第一個成員物件的索引值為 0,而且 member 物件在集合中的總數時的Properties集合的Count屬性減 1 的值。The first member object in the collection has an index value of 0, and the total number of member objects in the collection is the value of the Properties collection's Count property minus 1.

範例Example

下列程序會使用 Properties 屬性來列印至偵錯視窗表單上控制項相關聯的所有屬性。The following procedure uses the Properties property to print all the properties associated with the controls on a form to the Debug window. 若要執行這段程式碼,請將名為cmdListProperties表單上的命令按鈕並將下列程式碼貼入表單的宣告區段。To run this code, place a command button named cmdListProperties on a form and paste the following code into the form's Declarations section. 按一下此指令按鈕,即可將屬性清單印到 [偵錯] 視窗中。Click the command button to print the list of properties in the Debug window.

Private Sub cmdListProperties_Click() 
 ListControlProps Me 
End Sub 
 
Public Sub ListControlProps(ByRef frm As Form) 
 Dim ctl As Control 
 Dim prp As Property 
 
 On Error GoTo props_err 
 
 For Each ctl In frm.Controls 
 Debug.Print ctl.Properties("Name") 
 For Each prp In ctl.Properties 
 Debug.Print vbTab & prp.Name & " = " & prp.Value 
 Next prp 
 Next ctl 
 
props_exit: 
 Set ctl = Nothing 
 Set prp = Nothing 
Exit Sub 
 
props_err: 
 If Err = 2187 Then 
 Debug.Print vbTab & prp.Name & " = Only available at design time." 
 Resume Next 
 Else 
 Debug.Print vbTab & prp.Name & " = Error Occurred: " & Err.Description 
 Resume Next 
 End If 
End Sub

支援和意見反應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.