View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
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!