Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
Gosh havent been on here for a while. Okay - I have a folder that has 10 to 30 files that I need to open one at a time and export info from each file to a master workbook, close and start on the next until they have all been covered. I am in need of a piece of code that can find and open (regardless of file name) close and start on the next. I can fill in the code that will export the data, its the opening the files one at a time I cant do. Anyone out there that can help? Many thanks John |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim sPath as String, sName as String
Dim bk as Workbook sPath = "C:\Myfolder\" sName = Dir(sPath & "*.xls") do while sName < "" set bk = workbooks.Open(sPath & sName) bk.close SaveChanges:=False sName = Dir() Loop -- Regards, Tom Ogilvy "JohnUK" wrote: Hi All, Gosh havent been on here for a while. Okay - I have a folder that has 10 to 30 files that I need to open one at a time and export info from each file to a master workbook, close and start on the next until they have all been covered. I am in need of a piece of code that can find and open (regardless of file name) close and start on the next. I can fill in the code that will export the data, its the opening the files one at a time I cant do. Anyone out there that can help? Many thanks John |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Tom,
Many thanks, I will try this later and let you know how I get on. Regards John "Tom Ogilvy" wrote: Dim sPath as String, sName as String Dim bk as Workbook sPath = "C:\Myfolder\" sName = Dir(sPath & "*.xls") do while sName < "" set bk = workbooks.Open(sPath & sName) bk.close SaveChanges:=False sName = Dir() Loop -- Regards, Tom Ogilvy "JohnUK" wrote: Hi All, Gosh havent been on here for a while. Okay - I have a folder that has 10 to 30 files that I need to open one at a time and export info from each file to a master workbook, close and start on the next until they have all been covered. I am in need of a piece of code that can find and open (regardless of file name) close and start on the next. I can fill in the code that will export the data, its the opening the files one at a time I cant do. Anyone out there that can help? Many thanks John |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Tom,
Many thanks, It worked a treat. Take care Regards John "Tom Ogilvy" wrote: Dim sPath as String, sName as String Dim bk as Workbook sPath = "C:\Myfolder\" sName = Dir(sPath & "*.xls") do while sName < "" set bk = workbooks.Open(sPath & sName) bk.close SaveChanges:=False sName = Dir() Loop -- Regards, Tom Ogilvy "JohnUK" wrote: Hi All, Gosh havent been on here for a while. Okay - I have a folder that has 10 to 30 files that I need to open one at a time and export info from each file to a master workbook, close and start on the next until they have all been covered. I am in need of a piece of code that can find and open (regardless of file name) close and start on the next. I can fill in the code that will export the data, its the opening the files one at a time I cant do. Anyone out there that can help? Many thanks John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
To many files open at one time!! Helllllp!!! | Setting up and Configuration of Excel | |||
Testers needed for code page : create and mail PDF files in Excel 2007 with the MS PDF add-in | Excel Discussion (Misc queries) | |||
TWO FILES OPEN AT SAME TIME XLS:1 AND XLS:2 GROUP??? | Excel Discussion (Misc queries) | |||
Code needed big time! | Excel Programming | |||
Batch file to start multiple excel files with auto_open() macro. Delay code needed | Excel Programming |