+ Reply to Thread
Results 1 to 3 of 3

Simple Array Looping

  1. #1
    Nikky
    Guest

    Simple Array Looping

    I have a macro written to open a .csv file, process, and close it, but I'm
    having trouble figuring out how to loop through a list I define that will
    give each of the document names to open. I could read in a list from a .txt
    or even define the list manually in VB, but I'm not sure how to "tell" the
    loop to pick an item in the array, then define that number as a variable
    that I can enter in my command to open the document, then (after closing) run
    the next item in the array.

    The array contents resemble {769290163 6017502167 5621119573 ...}
    The document names resemble 769290163.csv

  2. #2
    Forum Contributor
    Join Date
    11-16-2004
    Posts
    282
    Repetitive processing of files using a loop

    Nikky,

    The following code should work for you (replace my reference w/yours):
    Please Login or Register  to view this content.
    Hope this helps,
    theDude

  3. #3
    Nikky
    Guest

    Re: Simple Array Looping

    Thanks, this was dead on.

    "Bob Phillips" wrote:

    >
    > For i = LBound(myArray) To UBound(myArray)
    > filename = myarray(i)
    > 'rest of code
    > Next i
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Nikky" <[email protected]> wrote in message
    > news:[email protected]...
    > > I have a macro written to open a .csv file, process, and close it, but I'm
    > > having trouble figuring out how to loop through a list I define that will
    > > give each of the document names to open. I could read in a list from a

    > ..txt
    > > or even define the list manually in VB, but I'm not sure how to "tell" the
    > > loop to pick an item in the array, then define that number as a variable
    > > that I can enter in my command to open the document, then (after closing)

    > run
    > > the next item in the array.
    > >
    > > The array contents resemble {769290163 6017502167 5621119573 ...}
    > > The document names resemble 769290163.csv

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1