Subscript Out of Range Error in UFT

If you have initialized an array in VB script while coding and later there is a requirement to resize that array, in that case, if you change the size of that array without reinitializing it, then you will get this error.

For example you have initialized an array like :

Dim  MyArray(3,4)

And later without reinitializing the above array if you increase size of it, then it will throw “Subscript Out of Range Error”.

Solution:

To fix above mentioned error you need to reinitialize array by using “ReDim”

For example for above mentioned array you need to write the code like below,

ReDim MyArray(rowcount, columncount)

Leave a Reply

Your email address will not be published. Required fields are marked *