ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cancel save dialog box (https://www.excelbanter.com/excel-programming/412871-cancel-save-dialog-box.html)

Sandy

Cancel save dialog box
 
I have the following code which works fine except that the save dialog box
pops up.
Having already saved the workbook I do not want the save box to display -
how do I prevent it?

Private Sub xxxxx()
'stuff
ThisWorkbook.Save
Application.Quit
End Sub

TIA
Sandy


dennis

Cancel save dialog box
 
It should not display another message. Have you got other workbooks open than
the one you are programmatically saving ?
You can stop the message by putting this before your quit statement

Application.DisplayAlerts = False

"Sandy" wrote:

I have the following code which works fine except that the save dialog box
pops up.
Having already saved the workbook I do not want the save box to display -
how do I prevent it?

Private Sub xxxxx()
'stuff
ThisWorkbook.Save
Application.Quit
End Sub

TIA
Sandy



Sandy

Cancel save dialog box
 
Hi Dennis
There were no other books open; I was however doing a 'SaveAs' which was in
the code prior to 'ThisWorkbook.Save' so I suppose that might have had a
bearing - your suggestion works perfectly though.
Thank you.
Sandy

"Dennis" wrote in message
...
It should not display another message. Have you got other workbooks open
than
the one you are programmatically saving ?
You can stop the message by putting this before your quit statement

Application.DisplayAlerts = False

"Sandy" wrote:

I have the following code which works fine except that the save dialog
box
pops up.
Having already saved the workbook I do not want the save box to display -
how do I prevent it?

Private Sub xxxxx()
'stuff
ThisWorkbook.Save
Application.Quit
End Sub

TIA
Sandy



FSt1

Cancel save dialog box
 
hi
be sure to turn alerts back on before you exit the sub.
Application.displayalerts = true

Regards
FSt1

"Sandy" wrote:

Hi Dennis
There were no other books open; I was however doing a 'SaveAs' which was in
the code prior to 'ThisWorkbook.Save' so I suppose that might have had a
bearing - your suggestion works perfectly though.
Thank you.
Sandy

"Dennis" wrote in message
...
It should not display another message. Have you got other workbooks open
than
the one you are programmatically saving ?
You can stop the message by putting this before your quit statement

Application.DisplayAlerts = False

"Sandy" wrote:

I have the following code which works fine except that the save dialog
box
pops up.
Having already saved the workbook I do not want the save box to display -
how do I prevent it?

Private Sub xxxxx()
'stuff
ThisWorkbook.Save
Application.Quit
End Sub

TIA
Sandy



Sandy

Cancel save dialog box
 
Good point!
Thanks
Sandy

"FSt1" wrote in message
...
hi
be sure to turn alerts back on before you exit the sub.
Application.displayalerts = true

Regards
FSt1

"Sandy" wrote:

Hi Dennis
There were no other books open; I was however doing a 'SaveAs' which was
in
the code prior to 'ThisWorkbook.Save' so I suppose that might have had a
bearing - your suggestion works perfectly though.
Thank you.
Sandy

"Dennis" wrote in message
...
It should not display another message. Have you got other workbooks
open
than
the one you are programmatically saving ?
You can stop the message by putting this before your quit statement

Application.DisplayAlerts = False

"Sandy" wrote:

I have the following code which works fine except that the save dialog
box
pops up.
Having already saved the workbook I do not want the save box to
display -
how do I prevent it?

Private Sub xxxxx()
'stuff
ThisWorkbook.Save
Application.Quit
End Sub

TIA
Sandy



dennis

Cancel save dialog box
 
Does this actually matter in this case because the next statement was
quitting the app ?
Won't they automatically be back on next time Excel is loaded ?

"FSt1" wrote:

hi
be sure to turn alerts back on before you exit the sub.
Application.displayalerts = true

Regards
FSt1

"Sandy" wrote:

Hi Dennis
There were no other books open; I was however doing a 'SaveAs' which was in
the code prior to 'ThisWorkbook.Save' so I suppose that might have had a
bearing - your suggestion works perfectly though.
Thank you.
Sandy

"Dennis" wrote in message
...
It should not display another message. Have you got other workbooks open
than
the one you are programmatically saving ?
You can stop the message by putting this before your quit statement

Application.DisplayAlerts = False

"Sandy" wrote:

I have the following code which works fine except that the save dialog
box
pops up.
Having already saved the workbook I do not want the save box to display -
how do I prevent it?

Private Sub xxxxx()
'stuff
ThisWorkbook.Save
Application.Quit
End Sub

TIA
Sandy



FSt1

Cancel save dialog box
 
hi
maybe not. but it's been my experience that the two commands always be used
togeather regardless ie just get in the habit of turning alerts back on just
in case.

Regards
FSt1

"Dennis" wrote:

Does this actually matter in this case because the next statement was
quitting the app ?
Won't they automatically be back on next time Excel is loaded ?

"FSt1" wrote:

hi
be sure to turn alerts back on before you exit the sub.
Application.displayalerts = true

Regards
FSt1

"Sandy" wrote:

Hi Dennis
There were no other books open; I was however doing a 'SaveAs' which was in
the code prior to 'ThisWorkbook.Save' so I suppose that might have had a
bearing - your suggestion works perfectly though.
Thank you.
Sandy

"Dennis" wrote in message
...
It should not display another message. Have you got other workbooks open
than
the one you are programmatically saving ?
You can stop the message by putting this before your quit statement

Application.DisplayAlerts = False

"Sandy" wrote:

I have the following code which works fine except that the save dialog
box
pops up.
Having already saved the workbook I do not want the save box to display -
how do I prevent it?

Private Sub xxxxx()
'stuff
ThisWorkbook.Save
Application.Quit
End Sub

TIA
Sandy




All times are GMT +1. The time now is 06:19 AM.

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