Better Arrays for VBA
About
This is a VBA Class Module that introduces a better Array system, object and properties.
See the Download section to download the cls file (Class Module).
When downloaded, see the How to install section to learn how to implement Better Arrays in your VBA Project.
Finally we recommend you to see the Documentation section to learn how to use Better Arrays.
Download
Better Arrays – List + Utils • version 2.2.1 (3.85 KB) (Latest)
Better Arrays – List + Utils • version 2.2.0 (3.85 KB)
Better Arrays – List + Utils • version 2.1.0 (3.74 KB)
Better Arrays • version 2.0.0 (13.70 KB)
Better Arrays • version 1.4.4 (13.52 KB)
Better Arrays • version 1.43 (12.25 KB)
Better Arrays • version 1.42 (11.45 KB)
Better Arrays • version 1.41 (10.63 KB)
Better Arrays • version 1.40 (10.71 KB)
Better Arrays • version 1.30 (10.45 KB)
Better Arrays • version 1.20 (8.76 KB)
Better Arrays • version 1.17 (8.86 KB)
Better Arrays • version 1.16 (8.55 KB)
Better Arrays • version 1.15 (7.11 KB)
Better Arrays • version 1.14 (5.49 KB)
Better Arrays • version 1.13 (3.44 KB)
Better Arrays • version 1.12 (3.25 KB)
Better Arrays • version 1.11 (3.11 KB)
Better Arrays • version 1.10 (2.73 KB)
Better Arrays.zip • version 1.00 (2.79 KB) | contains BA_Arrays.cls, About.txt, How to install.txt and Documentation.txt
BA_Arrays.cls • version 1.00 (2.61 KB)
Changelog
v2.2.1 (Released on 2022-02-03)
-
Fixed an issue with the Splice function.
​
v2.2.0 (Released on 2022-01-22)
-
Added out of range errors when getting or setting an item from an invalid index;
-
Fixed NewList function.
​
v2.1.0 (Released on 2022-01-22)
-
Added new functions:
-
Fill​;
-
Find;
-
FindIndex;
-
Flat;
-
Reduce;
-
ReduceRight;
-
-
Added Items parameter to the Splice function;​
-
The ToString function now also converts arrays and Lists to string;
-
Added Utils module with the functions:
-
NewList;
-
IsList.
-
​
v2.0.0 (Released on 2022-01-17)
-
Added "Includes" and "Map" functions​;
-
Added Index parameter for "Join" callback function.
-
Changed function names:
-
"AddItem" to "Add";
-
"RemoveItem" to "Remove";
-
"GetItems" to "Clone";
-
-
Changed "Length" function to be a read-only property.​
​
v1.4.4 (Released on 2021-05-12)
- Changed version format from x.xx to x.x.x;
- 'Sort' function now supports an optional custom sorting function like the 'Filter' function;
- 'Join' function now supports an optional custom joining function like the 'Filter' function;
- Small improvements were made.
v1.43 (Released on 2020-11-08)
- Added 'Intersect' function;
- Fixed an issue when passing an index equal to the list's length in the 'AddItem' method.
v1.42 (Released on 2020-10-22)
- Added 'Shuffle' function;
- Fixed an issue when passing an index equal to the list's length in the 'AddItem' method.
v1.41 (Released on 2020-05-20)
- Fixed an issue with the 'Reverse' function;
- Changed all Integer to Long.
v1.40 (Released on 2020-05-04)
- Added 'Splice' function;
- Added 'ToString' function;
- Removed 'SuppressErrors' property;
- Removed error handling;
- Made 'Slice' function EndIndex optional;
- A number of issues have been fixed and various improvements were made.
NOTE: This version may be incompatible with code written with previous versions of Better Arrays.
v1.30 (Released on 2020-04-19)
- Added 'GetItems' function;
- Added 'Last' function;
- Added 'Filter' function;
- Added 'SuppressErrors' property;
- 'Concat', 'Reverse', 'Sort' and 'Slice' functions now return a List object instead of an array.
NOTE: This version may be incompatible with code written with previous versions of Better Arrays.
v1.20 (Released on 2020-03-15)
- Changed Items property;
- Added Item property;
- Made initial Items an array.
NOTE: This version may be incompatible with code written with previous versions of Better Arrays.
v1.17 (Released on 2020-02-13)
- Fixed an issue when adding an object to a list using the AddItem method.
v1.16 (Released on 2019-09-28)
- Improved error handling;
- Some improvements were made;
- Fixed an issue with the Items property.
v1.15 (Released on 2019-09-26)
- Added Clear method;
- Added some error handling;
- Some improvements were made.
v1.14 (Released on 2019-09-20)
- Some improvements were made;
- Fixed some issues.
v1.13 (Released on 2019-09-16)
- Fixed an issue that returned an error when using the RemoveItem Mehtod in a List of Objects.
v1.12 (Released on 2019-09-06)
- Added SetItems method;
- Improved some methods;
- Fixed some issues.
v1.11 (Released on 2019-08-31)
- Improved some methods;
- Fixed some issues.
v1.10 (Released on 2019-08-30)
- Added new methods and functions;
- Improved some methods;
- Fixed some issues.
v2.2.1 (Released on 2022-02-03)
-
Fixed an issue with the Splice function.
​
v2.2.0 (Released on 2022-01-22)
-
Added out of range errors when getting or setting an item from an invalid index;
-
Fixed NewList function.
​
v2.1.0 (Released on 2022-01-22)
-
Added new functions:
-
Fill​;
-
Find;
-
FindIndex;
-
Flat;
-
Reduce;
-
ReduceRight;
-
-
Added Items parameter to the Splice function;​
-
The ToString function now also converts arrays and Lists to string;
-
Added Utils module with the functions:
-
NewList;
-
IsList.
-
​
v2.0.0 (Released on 2022-01-17)
-
Added "Includes" and "Map" functions​;
-
Added Index parameter for "Join" callback function.
-
Changed function names:
-
"AddItem" to "Add";
-
"RemoveItem" to "Remove";
-
"GetItems" to "Clone";
-
-
Changed "Length" function to be a read-only property.​
Show more
Documentation (versions 1.40, 1.4.4 and 2.0.0+)
Better Arrays - versions 1.40, 1.4.4 and 2.0.0+
NOTE: This documentation only applies to versions 1.40,1.43 and 2.0.0+ of Better Arrays. To see the documentation of other versions click here.
To distinguish VBA Arrays from Better Array's arrays, we use List for the term Array.
Index
List members
-
Items
-
Item
-
SetItems / Clone (v2.x.x)
-
GetItems (prior to v2.0.0)
-
Join
-
ToString
-
AddItem (prior to v2.0.0) / Add (v2.x.x)
-
RemoveItem (prior to v2.0.0) / Remove (v2.x.x)
-
Clear
-
Length
-
IndexOf
-
Includes (v2.0.0)
-
Reverse
-
Sort
-
Shuffle (v1.42)
-
Slice
-
Splice
-
Concat
-
Intersect (v1.43)
-
Filter
-
Map (v2.x.x)
-
Fill (v2.1.x)
-
Find (v2.1.x)
-
FindIndex (v2.1.x)
-
Flat (v2.1.x)
-
Reduce (v2.1.x)
-
ReduceRight (v2.1.x)
-
Last
Utils members (v2.1.x)
Note: The ListUtils module is optional and is not required for the List class to work.
-
NewList
-
IsList
Get Started
​Create a new Better Arrays List. Better Arrays' arrays are called Lists.
Example [VBA]
Dim MyList As New List
Properties and Methods
Items
Sets or gets all items of a List in array format.
Syntax
<ListName>.Items
Example [VBA]
Dim MyList As New List
MyList.Items = Array("item1", "item2") 'Sets the items to an array
​
' MyList.Items --> returns an array, so you can use MyList.Items(<index>) to return an item from the List/array.
Debug.Print MyList.Items(0) 'Prints the first item of the returned array, in this case "item1"
​
' Note: You can use the Item property to set or return an item from the List.
​Item
Sets or gets an item of a List. The item can be of any type. When trying to get an item of an invalid index, an error is returned.
​
Note: This is the default property of the List class, so it's optional (e.g. you can use MyList(0), instead of MyList.Item(0)).