Closing Multiple Workbooks

Higher Learning

New Member
Joined
May 11, 2010
Messages
14
I have macro which allows me to create a pivot table based on a specific report. I can generate this report directly from an agency system. The report opens as an Excel workbook. Because the system's report has a life of 24 hours after it's retrieved each morning someone in the office after retrieving the report from the system, names the report and saves it to a folder on the agency's shared drive.

The macro works well. However, at the end of the macro I want to be able to close the source workbook/report. The macro is hard-coded to close the system's report since the Excel workbook name is always the same. Example: "MyReport.xls" But I can't figure out how to close an already saved report because it's name is never the same. The report name is actually a date. Example: 06-10-11.xls. I thought the file path might be a way since the saved reports are located in same folder. But I haven't been able to come up with any workable code.

Does anyone have any idea how to do code this?
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,224,585
Messages
6,179,703
Members
452,938
Latest member
babeneker

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