Results 1 to 4 of 4

Reading multiple filenames into array in macro - last one processed first

Threaded View

seanaob Reading multiple filenames... 12-17-2009, 01:12 AM
Marzuk Re: Reading multiple... 12-17-2009, 02:25 AM
seanaob Re: Reading multiple... 12-17-2009, 03:06 AM
Marzuk Re: Reading multiple... 12-17-2009, 03:25 AM
  1. #1
    Registered User
    Join Date
    12-16-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    2

    Reading multiple filenames into array in macro - last one processed first

    I have been using this code to choose multiple files to manipulate:
    ArTemp = Application.GetOpenFilename(FileFilter:="All files (*.*), *.*", MultiSelect:=True)
     '(where ArTemp is a variant)
    For i = 1 To UBound(ArTemp)      
    myfile = ArTemp(i)      
    Workbooks.OpenText Filename:=myfile    
    ' (do suff with this file)
    Next i
    Open file dialog opens, I shift-click to choose a list of files, macro runs it thing using those files. Strangely, however, the last file in the list is always processed first, follwed by the first, second, third, etc. I have been putting up with this for a very long time now, and looking around on the web, but it's about driving me crazy now! I have to admit, I don't know very much about vba stores to arrays. My collegue has a work around that stores the first record to a temp variable, then cycles thru the array, but I am interested in the WHY of it.
    Last edited by seanaob; 12-17-2009 at 07:35 PM.

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