共用方式為


Count 屬性

回傳一個 長 (長 整數) 包含集合或 字典 物件中項目數量。 唯讀。

語法

物件

物件總是「套用到」清單中某個項目的名稱。

註解

以下程式碼說明了 Count 屬性的使用方式。

Dim a, d, i             'Create some variables
Set d = CreateObject("Scripting.Dictionary")
d.Add "a", "Athens"     'Add some keys and items.
d.Add "b", "Belgrade"
d.Add "c", "Cairo"
a = d.Keys              'Get the keys
For i = 0 To d.Count -1 'Iterate the array
    Print a(i)          'Print key
Next
...

另請參閱

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應