Hi,
I am trying to create a small macro that will loop throufh a list of Excel files. All files are in the same folder and the file name allwayst starts with "Item 2010". The rest of the file name varies form 01 04 to 12 31. The complete name of the first file would be "Item 2010 01 04.xls".
So far I have come up with this code. The problem is that the code only picks up the first file and does not continue with the next one (e.g. Item 2010 01 05.xls).
Can anyone advise?
Many thanks!
Ron
I am trying to create a small macro that will loop throufh a list of Excel files. All files are in the same folder and the file name allwayst starts with "Item 2010". The rest of the file name varies form 01 04 to 12 31. The complete name of the first file would be "Item 2010 01 04.xls".
So far I have come up with this code. The problem is that the code only picks up the first file and does not continue with the next one (e.g. Item 2010 01 05.xls).
Code:
MyFolder = "C:\Mydocs\"
MyFile = Dir(MyFolder & "Item 2010 *.xls")
Do While MyFile <> ""
Workbooks.Open Filename:=MyFile
'Perform other actions
ActiveWorkbook.Close False
Loop
Many thanks!
Ron