+ Reply to Thread
Results 1 to 3 of 3

Opening all files located in a specific directory

  1. #1
    DaSo
    Guest

    Opening all files located in a specific directory

    Hi everybody,

    Having done just a few macros for Excel, I´m a total beginner in VB and
    I would like to ask you how to open all files located in a specific
    directories at once. I thought the following might work, but it doesn´t:

    Sub Makro1()

    ChDir "C:\user\Results"
    Workbooks.Open FileName:="*.*"

    End Sub


    Any help?




    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

  2. #2
    Tom Ogilvy
    Guest

    Re: Opening all files located in a specific directory

    Sub Makro1()

    ChDir "C:\user\Results"
    fName = Dir("C:\user\Results\*.xls")
    do while fName <> ""
    workbooks.Open fName
    fName = dir()
    Loop

    End Sub

    Assumes you don't have any directories with a .xls extension.

    --
    Regards,
    Tom Ogilvy



    "DaSo" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi everybody,
    >
    > Having done just a few macros for Excel, I´m a total beginner in VB and
    > I would like to ask you how to open all files located in a specific
    > directories at once. I thought the following might work, but it doesn´t:
    >
    > Sub Makro1()
    >
    > ChDir "C:\user\Results"
    > Workbooks.Open FileName:="*.*"
    >
    > End Sub
    >
    >
    > Any help?
    >
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!




  3. #3
    DaSo
    Guest

    Re: Opening all files located in a specific directory

    Thanks and regards to Tom Ogilvy, problem solved.
    Dan



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

+ 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