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?
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?