Name

Dictionary.Count Property

Property Data Subtype

Long

Description

A read-only property that returns the number of key/item pairs in a Dictionary object.

Rules at a Glance

Unlike a Collection object, the Dictionary object is always zero-based.

Example

The following code fragment shows how you can use the Count property along with the Dictionary object’s Items property:

Dim vArray
vArray = DictObj.Items
For i = 0 to DictObj.Count -1
   Set oObj = vArray(i)
Next

Get VBScript in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.