Passing Arrays Out

It is possible to pass arrays out of subroutines and functions.
An array can be returned from a function (or property).
The receiving array must have the same data type as the arrays being returned from the function (or property)
If a function returns an array (i.e. a Variant) include the word Array in the name of the function
If the data types do not match then a compile error will be thrown.
If the function returns an explicitly typed array then the variable must also be a matching explicitly typed array.


Returning a String Array

This function returns an array of Long integers.
The function declaration returns an arrays of type Long.
The variable "myvalues" is also declared as an array of type Long.


Returning a Variant Array

This function returns an array which can be of any type


Returning as a Variant

It is possible to return an array of any dimension and any data type.
This can be achieved by declaring the return value as just a Variant.


© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext