ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Save this? (https://www.excelbanter.com/excel-programming/415988-how-save.html)

Ak Man

How to Save this?
 
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
MsgBox "Cannot Save this Workbook...Closing Excel!!!"
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
Application.Quit
End Sub

--
Ak

Barb Reinhardt

How to Save this?
 
You could go to the immediate window and type
APplication.EnableEvents = False

and save it.

Then turn the events back on if you need them.
--
HTH,
Barb Reinhardt



"Ak Man" wrote:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
MsgBox "Cannot Save this Workbook...Closing Excel!!!"
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
Application.Quit
End Sub

--
Ak


Ak Man

How to Save this?
 
Perfect!!!
Thanks....I was thinking about using enable events but just couldn't figure
out how.....
--
Ak


"Barb Reinhardt" wrote:

You could go to the immediate window and type
APplication.EnableEvents = False

and save it.

Then turn the events back on if you need them.
--
HTH,
Barb Reinhardt



"Ak Man" wrote:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
MsgBox "Cannot Save this Workbook...Closing Excel!!!"
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
Application.Quit
End Sub

--
Ak



All times are GMT +1. The time now is 07:46 PM.

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