06-30-2023 12:36 AM
Hi,
I have a fixed array, which is dimensioned at the top of the code as usual, and then partially used later on. After this, I wish to empty the array so that it can be used in a following piece of code. The method Erase for VBS would seem to be appropriate and the help files give an example which seems to fit my needs. However, when the code reaches the Erase call it fails with the error message "Type mismatch: Erase".
Thinking this might be something to do with it only being partially filled, I then copied the sample code from the help files and that doesn't work either!
My code is essentially as follows:
Dim AvgVal(1)
AvgVal(0) = 5
Erase(AvgVal)
And the help file code is:
Dim NumericArray(11)
Dim DynamicArray()
ReDim DynamicArray(7)
Erase(NumericArray)
Erase(DynamicArray)
Why isn't either piece of code working?
Thanks,
Simon.
Solved! Go to Solution.
06-30-2023 02:56 AM
Hi Simon,
it seems that the error message is somehow missleading. The cause of the error message is the use of brackets. Try
Erase AvgVal
or
call Erase(AvgVal)
instead. This should work.
Regards,
Rainer