If you use the Preserve keyword, then you can resize only the last array dimension, and you can't change the number of dimensions at all. For example, if your. QTP uses VBScript to specify a test procedure, and to manipulate the objects and 3) The size of an array can be changed at run-time using ReDim statement. Environment Variable usage Array Redim Preserve Redim arr(2). arr(0) = 1 Redim preserve arr(3). Dim arr() ReDim arr(5) arr(0)=10 arr(1)=15 arr(2)=20 arr(3)=25 We will use the Preserve keyword with the ReDim in the above example. For initial use, it must be initialized with some value i.e. size. This will be done using ReDim. ReDim myArray(3) 'before using first time. ReDim arr(1). Msgbox arr(0) ' Return Empty. Msgbox arr(1) ' Return Empty. ' If Preserve is not used array will be Re-Dimensioned, but existing values will be. To preserve the data, you can resize it using Preserve keyword. Code: Redim Preserve Array(10). Want to fast track your QTP/UFT Learning?. Answer / paayal. Dim is a data type(variant) that user can assign to a variable like Dim User User = "QTP" Redim can be use to reinitialize the variable. We can. The ReDim statement is used to size or resize a dynamic array. data contained in the array. to avoid this you should use Preserve Keyword before the array name. Vb Script for How to Stop QTP while an Error Occur. Details of "Redim" & "Redim preserve". NOTE: QTP's vbscript can allows you to resize array using “redim” stmt. Option explicit. Dim x().