Code needed to open files one at a time
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
|