?
Solved

Out of range error in vbscript array.

Posted on 2006-03-20
1
Medium Priority
?
350 Views
Last Modified: 2012-06-27
I am trying to populate a bidimensional array using the following VBscript codes:
...........
Sequen=0
For Each objFileLoop in objWrkFolder.Files
Sequen=Sequen+1
 ReDim Preserve astrRecord(Sequen,4)
astrRecord(Sequen-1,0)=Sequen
astrRecord(Sequen-1,1)=CStr(objWb.Cells(2, 2).Value)
astrRecord(Sequen-1,2)=Right(objwb.Cells(1,9).value,Len(objwb.Cells(1,9).value)-15)
astrRecord(Sequen-1,3)="dDocument_Service"
next
....................

This loop should populate an array from a given excel spread sheet. I am able to te get the first row of the array but on the second loop turn, i got the error message: Out of range error.
Do you guys have another solution for those codes?
Thank you!!
0
Comment
Question by:ggmisadmin
1 Comment
 
LVL 3

Accepted Solution

by:
fastlivehelp earned 1000 total points
ID: 16243099
Try this:

...........
Sequen=0
For Each objFileLoop in objWrkFolder.Files
Sequen=Sequen+1
 ReDim Preserve astrRecord(4,Sequen)
astrRecord(0,Sequen-1)=Sequen
astrRecord(1,Sequen-1)=CStr(objWb.Cells(2, 2).Value)
astrRecord(2,Sequen-1)=Right(objwb.Cells(1,9).value,Len(objwb.Cells(1,9).value)-15)
astrRecord(3,Sequen-1)="dDocument_Service"
next
....................

The redim only works on the last dimension of the array.

--John
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Introduction to Processes

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question