Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where are the Excel Temporary save files located? nitsa Excel Discussion (Misc queries) 5 April 2nd 23 08:34 PM
opening directory from excel Pradyumna. Excel Programming 1 June 16th 04 01:27 PM
Check if directory empty OR no of files in directory. Michael Beckinsale Excel Programming 2 December 4th 03 10:12 PM
Open files from specific directory John Rawlins Excel Programming 1 October 16th 03 04:03 PM
OPENING A FILE LOCATED IN A DIRECTORY DIFFERENT FROM CURRENT DIRECTORS Steven R. Berke Excel Programming 1 July 25th 03 04:49 PM


All times are GMT +1. The time now is 04:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"