Application.Quit

K

kirkm

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

Thanks - Kirk
 
M

Mike H

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
 
K

kirkm

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
 
K

kirkm

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
 
M

Mike H

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
 
O

Orion Cochrane

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top