ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.Quit (https://www.excelbanter.com/excel-programming/418637-application-quit.html)

kirkm[_7_]

Application.Quit
 
Application.Quit closes Excel. Is there an equivalent that
just closes the Workbook ?

Thanks - Kirk

Mike H

Application.Quit
 
Hi,

Activeworkbook.close

You may be prompted to save changes and if you don't want that use

Application.displayalerts=false

or you can save automatically

ActiveWorkbook.Close savechanges:=True

Mike


"kirkm" wrote:

Application.Quit closes Excel. Is there an equivalent that
just closes the Workbook ?

Thanks - Kirk


kirkm[_7_]

Application.Quit
 
On Fri, 17 Oct 2008 00:55:00 -0700, Mike H
wrote:

Hi,

Activeworkbook.close


Thanks Mike, that did work but had an odd side effect.

If I open the workbook again, none of the double click events
work. (Until I close and Open Excel again).

These usually fire 'Private Sub Worksheet_BeforeDoubleClick'.
but this is completly bypassed somehow.

I wonder why, any idea?

Thanks - Kirk

kirkm[_7_]

Application.Quit
 
On Fri, 17 Oct 2008 00:55:00 -0700, Mike H
wrote:

Hi,

Activeworkbook.close


Thanks Mike, that did work but had an odd side effect.

If I open the workbook again, none of the double click events
work. (Until I close and Open Excel again).

These usually fire 'Private Sub Worksheet_BeforeDoubleClick'.
but this is completly bypassed somehow.

I wonder why, any idea?

Thanks - Kirk

Mike H

Application.Quit
 
It sounds like your disabling events somewhere when you close this book and
they remain disabled until the application is closed and re-opened. I suspect
you have other code somwhere in this book.

Mike

"kirkm" wrote:

On Fri, 17 Oct 2008 00:55:00 -0700, Mike H
wrote:

Hi,

Activeworkbook.close


Thanks Mike, that did work but had an odd side effect.

If I open the workbook again, none of the double click events
work. (Until I close and Open Excel again).

These usually fire 'Private Sub Worksheet_BeforeDoubleClick'.
but this is completly bypassed somehow.

I wonder why, any idea?

Thanks - Kirk


Orion Cochrane

Application.Quit
 
The example you gave with turning display alerts off may have been used; use
the activeworkbook.close savechanges:=true example instead. Take out the
application.displayalerts=false line. You can also use ThisWorkbook instead
of ActiveWorkbook to narrow it down to the workbook containing the macro.
--
I am running on Excel 2003, unless otherwise stated. Please rate posts so we
know when we have answered your questions. Thanks.


"Mike H" wrote:

It sounds like your disabling events somewhere when you close this book and
they remain disabled until the application is closed and re-opened. I suspect
you have other code somwhere in this book.

Mike

"kirkm" wrote:

On Fri, 17 Oct 2008 00:55:00 -0700, Mike H
wrote:

Hi,

Activeworkbook.close


Thanks Mike, that did work but had an odd side effect.

If I open the workbook again, none of the double click events
work. (Until I close and Open Excel again).

These usually fire 'Private Sub Worksheet_BeforeDoubleClick'.
but this is completly bypassed somehow.

I wonder why, any idea?

Thanks - Kirk


Mike H

Application.Quit
 
Stopping display alerts will have no impact on events

"Orion Cochrane" wrote:

The example you gave with turning display alerts off may have been used; use
the activeworkbook.close savechanges:=true example instead. Take out the
application.displayalerts=false line. You can also use ThisWorkbook instead
of ActiveWorkbook to narrow it down to the workbook containing the macro.
--
I am running on Excel 2003, unless otherwise stated. Please rate posts so we
know when we have answered your questions. Thanks.


"Mike H" wrote:

It sounds like your disabling events somewhere when you close this book and
they remain disabled until the application is closed and re-opened. I suspect
you have other code somwhere in this book.

Mike

"kirkm" wrote:

On Fri, 17 Oct 2008 00:55:00 -0700, Mike H
wrote:

Hi,

Activeworkbook.close

Thanks Mike, that did work but had an odd side effect.

If I open the workbook again, none of the double click events
work. (Until I close and Open Excel again).

These usually fire 'Private Sub Worksheet_BeforeDoubleClick'.
but this is completly bypassed somehow.

I wonder why, any idea?

Thanks - Kirk


Orion Cochrane

Application.Quit
 
Oh, yes. What I was thinking was EnableEvents = False. Sorry.
--
I am running on Excel 2003, unless otherwise stated.


"Mike H" wrote:

Stopping display alerts will have no impact on events

"Orion Cochrane" wrote:

The example you gave with turning display alerts off may have been used; use
the activeworkbook.close savechanges:=true example instead. Take out the
application.displayalerts=false line. You can also use ThisWorkbook instead
of ActiveWorkbook to narrow it down to the workbook containing the macro.
--
I am running on Excel 2003, unless otherwise stated. Please rate posts so we
know when we have answered your questions. Thanks.


"Mike H" wrote:

It sounds like your disabling events somewhere when you close this book and
they remain disabled until the application is closed and re-opened. I suspect
you have other code somwhere in this book.

Mike

"kirkm" wrote:

On Fri, 17 Oct 2008 00:55:00 -0700, Mike H
wrote:

Hi,

Activeworkbook.close

Thanks Mike, that did work but had an odd side effect.

If I open the workbook again, none of the double click events
work. (Until I close and Open Excel again).

These usually fire 'Private Sub Worksheet_BeforeDoubleClick'.
but this is completly bypassed somehow.

I wonder why, any idea?

Thanks - Kirk



All times are GMT +1. The time now is 10:09 PM.

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