Load all files in a directory

  • Thread starter Thread starter Greg B...
  • Start date Start date
G

Greg B...

I would like to load all my .xls file, How would I do this please.


Thanks again

Greg
 
I have the below in a standard module of a surrogate file xyz.xls:
I open xyz; Run the Macro, then Close xyz;

Sub OpenMyFiles()
Dim sPath As String, sName As String
Dim bk As Workbook
sPath = "C:\My Documents\MyFavoriteFiles\"
sName = Dir(sPath & "*.xls")
Do While sName <> ""
Set bk = Workbooks.Open(sPath & sName)
' . . . process bk
' bk.Close Savechanges:=False ' or true
sName = Dir
Loop
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top