View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Code to close workbook

Hi Mason

You can close workbookA in the same macro that open workbookAB

After you open workbookB use this to close workbookA
ThisWorkbook.Close False 'not save

or
ThisWorkbook.Close False 'save the file



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Mason" wrote in message ...
I have code that opens an excel file. Can I have an Open event on the new
opened Excel file that closes the original file?

So workbookA code opens workbookB. The open event in workbookB closes
workbookA.
But I won't know the name of workbookA, and other workbooks may be open also
and we don't want them closed.