Link to home
Start Free TrialLog in
Avatar of Reeds
Reeds

asked on

How to declare and initialise dynamic arrays in VB script?

I have a for loop in which I am reading from an excel file. I want to put some values in an array. I tried doing:

i = 0
Dim arrayClientOrderID()
arrayClientOrderID(i)= ClientOrderID
i = i + 1

The above gives me an error. I don't know the size of the array because I am looping through each line of the excel file and taking the values for Client orderID. How can I assign and initialize dynamic arrays.
Avatar of hlarse
hlarse

Try this inside your loop:

ReDim Preaserve arrayClientOrderID(i)
arrayClientOrderID(i)= ClientOrderID
ASKER CERTIFIED SOLUTION
Avatar of hlarse
hlarse

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Reeds

ASKER

works, thanks
Avatar of RobSampson
Reeds, please accept an answer to close this question.

Thanks,

Rob.