Open Multiple excel files using VBA

Kayslover

Board Regular
Joined
Sep 22, 2020
Messages
168
Office Version
  1. 2013
Platform
  1. Windows
Hi

I have a macro that create 12 files from a template using the command:-

Rich (BB code):
ActiveWorkbook.SaveAs Filename:=Path & "01 January.xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled

ActiveWorkbook.SaveAs Filename:=Path & "02 February.xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled

ActiveWorkbook.SaveAs Filename:=Path & "03 March.xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled

Etc. etc. etc.

ActiveWorkbook.SaveAs Filename:=Path & "12 December.xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled

I am trying to use the following VBA to open all 12 files, however it only opens the Last file and the first file. I understand the last file as there is no 'ActiveWorkbook.Close once 12 December has been saved.

Rich (BB code):
Workbooks.Open Path & "01 January.xlsm"
Workbooks.Open Path & "02 February.xlsm"
Workbooks.Open Path & "03 March.xlsm"
Workbooks.Open Path & "04 April.xlsm"
etc etc etc

Please note Path is defined in the macro with the following command Path = ThisWorkbook.Path & "\"

Is it possible once all the files have been created that I can use VBA to open them all up?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,214,832
Messages
6,121,849
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top