Results 1 to 2 of 2

Thread: Obtaining data from several excel files

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2005
    Posts
    3

    Obtaining data from several excel files

    Hi there
    I am very new to VB but I need advice.
    I would like to write some VB code that I can point to a directory (and it's subdirectories) to identify the excel files in there and pull fields out of each file, into a new excel file. The fields will be in the same location in each file.
    What is the best way to do this? Is there a script out there that already does this?
    What I want to avoid is having someone have to manually open up and copy each of these fields to a new file (there are over 500 excel sheets).

    thanks for your help in advance!
    melyss

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Obtaining data from several excel files

    Is there a script out there that already does this?
    dunno search in code bank or google

    myfile = Dir(mypath & "\*.xls")

    will return the first xls file in mypath folder

    i think
    workbooks.open mypath & "\" & myfile
    will open it for you

    you can then in a do loop
    myfile = Dir
    find the next xls file
    and open with the same command as above
    when myfile = "", no more xls files in folder

    start on that and post again whhen you get stuck or when you are ready to find out about the sub folder

    pete

Posting Permissions

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



Click Here to Expand Forum to Full Width