ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with quiting a workbook (https://www.excelbanter.com/excel-programming/338818-help-quiting-workbook.html)

Tempy

Help with quiting a workbook
 
Hi All, i have a problem in trying to close my workbook with code. My
workbook is called "Recon_Master.xls. I use the following code:
Workbooks("Recon_Master.XLS").Close SaveChanges:=False

It works, but leaves like an excel "shell" and i need it all to close ?
I have used application.quit as well but if the user has another
workbook open it closes that as well and i had a very irate user on my
hands !!


Tempy

*** Sent via Developersdex http://www.developersdex.com ***

Rob Docherty

Help with quiting a workbook
 

application.workbooks.count

Will tell you how many workbooks are open, if this is 0 then you can call
the quit code.

Hope this helps,

Rob

"Tempy" wrote:

Hi All, i have a problem in trying to close my workbook with code. My
workbook is called "Recon_Master.xls. I use the following code:
Workbooks("Recon_Master.XLS").Close SaveChanges:=False

It works, but leaves like an excel "shell" and i need it all to close ?
I have used application.quit as well but if the user has another
workbook open it closes that as well and i had a very irate user on my
hands !!


Tempy

*** Sent via Developersdex http://www.developersdex.com ***



All times are GMT +1. The time now is 03:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com