Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How can I force a workbook to close?
I run this code: ThisWorkbook.EnableAutoRecover = False ThisWorkbook.Saved = True ThisWorkbook.Close That triggers this: Private Sub Workbook_BeforeClose(Cancel As Boolean) If ThisWorkbook.name = "MainFile.xls" Then Application.Quit End If End Sub But that kills the whole Excel-application! If I open Excel and then goto Start Office Excel, I have 2 instances of Excel open. I can end one instance pretty easy. However, if I have two workbooks open within the SAME instance, Excel doesn’t seem to be able to close one file and keep the other open. In fact, Excel opens several new files, all named ‘MainFile.xls’. VERY ANNOYING!!! How can I shut down any file named ‘MainFile.xls’ and keep other Excel files open? Thanks! Ryan-- |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Force Excel to close | Excel Programming | |||
How to force Excel wkbk to close | Excel Programming | |||
How do you force excel to save on close | Excel Discussion (Misc queries) | |||
Is there a way to force Excel to close workbooks independently? | Excel Discussion (Misc queries) | |||
Force a Message Box to close unanswered | Excel Programming |