Out of range error in vbscript array.

Posted on 2006-03-20
Last Modified: 2012-06-27
I am trying to populate a bidimensional array using the following VBscript codes:
For Each objFileLoop in objWrkFolder.Files
 ReDim Preserve astrRecord(Sequen,4)
astrRecord(Sequen-1,1)=CStr(objWb.Cells(2, 2).Value)

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!!
Question by:ggmisadmin
    1 Comment
    LVL 3

    Accepted Solution

    Try this:

    For Each objFileLoop in objWrkFolder.Files
     ReDim Preserve astrRecord(4,Sequen)
    astrRecord(1,Sequen-1)=CStr(objWb.Cells(2, 2).Value)

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


    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    How to silent print from safari browser 6 99
    post4 challenge 28 70
    scoreUp challenge 14 40
    How to split this in C++ 4 54
    This is an explanation of a simple data model to help parse a JSON feed
    In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    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…

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now