View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
walt walt is offline
external usenet poster
 
Posts: 8
Default open all files in a folder and ...

My macro works fine in reading the content of one file into a summary file.
But i don't want to start the macro for every single file in a specific
folder (selected by the user). Is there a way to tell Excel: open first
file in folder, run macro, close file, open next one, run macro, close
file.... until all files are done?

The actual opening routine looks like that:

Dim myFileName As Variant
Dim myWkbk As Workbook

myFileName = Application.GetOpenFilename("Excel files, *.xls")
If myFileName = False Then
Exit Sub
End If

Application.ScreenUpdating = False

Set myWkbk = Workbooks.Open(Filename:=myFileName)


TIA Walt