Reinitializes the elements of fixed-size arrays and releases dynamic-array storage space.
Syntax
Erase arraylist
The required arraylist argument is one or more comma-delimited array variables to be erased.
Remarks
Erase behaves differently depending on whether an array is fixed-size (ordinary) or dynamic. Erase recovers no memory for fixed-size arrays. Erase sets the elements of a fixed array as follows:
Type of Array | Effect of Erase on Fixed-Array Elements |
---|---|
Fixed numeric array | Sets each element to zero. |
Fixed string array (variable length) | Sets each element to a zero-length string (""). |
Fixed string array (fixed length) | Sets each element to zero. |
Fixed Variant array | Sets each element to Empty. |
Array of user-defined types | Sets each element as if it were a separate variable. |
Array of objects | Sets each element to the special value Nothing. |
Erase frees the memory used by dynamic arrays. Before your program can refer to the dynamic array again, it must redeclare the array variable's dimensions using a ReDim statement.