![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Location: Chad Miles
Posts: 6
|
I will be opening several files at one time. The macro will run on the active workbook then that work book is closed by the macro. The next workbook becomes active and the same process takes place. I get an error when the last macro is ran on the last workbook when i try to get the macro to close excel. How can i run this macro on all active files then close the excel program?
|
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Denver, Colorado USA
Posts: 4,014
|
Hi Milescm,
I assume that your code resides in the last workbook that you process. I'm wondering if the problem is that you close this last workbook before closing Excel? Closing the last workbook will of course stop the code from running since the code's ThisWorkbook object is no longer in existence. You should save ThisWorkbook, then do an Application.Quit to close Excel without saving. I hope this helps.
__________________
Keep Excelling. Damon VBAexpert Excel Consulting (My other life: http://damonostrander.com ) |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|