No - wrong on 2 counts.. once you define an array with a spcific number of dimensions, you can't add or remove dimensions, you can only change the size of the array. So, your ReDim could increase or decrease the number of ELEMENTS (cells) in the array, but not the number of dimensions. A one-dimensional array is a collection of rows with 1 column. You can only change the number of rows, not columns.
Secondly, [x][y] isn't a two-dimensional array, it's an array of arrays. Think of this:
$X = "a", "b", "c"
This creates and populates an array, with element 0 containing "a" and element 2 containing "c"
So
Dim $X[3]
$X[0] = "a", "b", "c"
$X[1] = "d", "e", "f"
$X[2] = "g", "h", "i"
Each element of the array "$X" contains yet another array, so you can specify
$V = $X[1][1]
'v=' $V ?
and $V will contain "e" - the second element of the $X array, and the second element of the array in that element. As you can see, it can get confusing.
Copy the above into a test script.. Then add:
$SubArray = $X[2]
For Each $Element in $SubArray
'SubElement=' $Element ?
Next
That should make it clear.
Then, you could actually re-dim $SubArray, and reassign it to your parent array.
ReDim Preserve $SubArray[3]
$SubArray[3] = "z"
$X[2] = $SubArray
'1: ' UBound($X[1]) ?
'2: ' UBound($X[2]) ?
You can see that the sub-arrays in element 1 and 2 of the parent array have different values now.
Glenn
_________________________
Actually I
am a Rocket Scientist!