Link Search Menu Expand Document

Keys

Description

The Keys() method returns a new array (0 based) that contains the keys for each index in the array.

Syntax

expression.Keys()

Parameters

None

Returns

Type
Variant()
Description
A 0-based Variant array containing the indexes used in the outermost internal array.

Example

Public Sub KeysExample()
    Dim result() As Variant
    Dim MyArray As BetterArray
    Set MyArray = New BetterArray
    
    MyArray.LowerBound = 10
    MyArray.Push 1, 2, 3, 4, 5, 6
    result = MyArray.Keys
    ' expected output:
    ' result is a zero-based array with the values: 10, 11, 12, 13, 14, 15
End Sub

Inspiration

Back to Docs