Skip to content

Count


Overview

The Count property of the Accounts class provides the total number of Account objects contained within the Accounts collection.

Syntax

vba
Accounts.Count

Return Value

When accessed, the Count property returns a Long integer representing the number of Account objects in the collection.

Example

This example demonstrates how to retrieve the number of accounts in an Accounts collection and display it:

vba
Sub DisplayNumberOfAccounts(accounts As Accounts)
    ' Get the number of accounts
    Dim totalAccounts As Long
    totalAccounts = accounts.Count

    ' Display the number of accounts
    MsgBox "There are " & totalAccounts & " accounts in the collection.", vbInformation
End Sub