ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how to intrupt Save and Save as? (https://www.excelbanter.com/excel-discussion-misc-queries/199619-how-intrupt-save-save.html)

edward

how to intrupt Save and Save as?
 
Hi everybody,
How can we intrupt Save and Save as in Excel ? I want to write my own code
instead of svaing a document when user clciks on save
--
Best regards,
Edward

Barb Reinhardt

how to intrupt Save and Save as?
 
You could add some Workbook_BeforeSave code to the workbook. I can't seem
to find a good reference now, but you should be able to find something by
Googling on it. Make sure you put this in the ThisWorkbook module.
--
HTH,
Barb Reinhardt



"Edward" wrote:

Hi everybody,
How can we intrupt Save and Save as in Excel ? I want to write my own code
instead of svaing a document when user clciks on save
--
Best regards,
Edward


edward

how to intrupt Save and Save as?
 
Thanks Barb, Basically my goal is to use the code to let the user to sort a
protected worksheet via vba ( I know have the code ) but the problem is user
can save the sorted workbook which im trying to avoid. I thought if I can
intrupt the save and save as then I can open a inputbox and if user gives a
correct password save the workbook otherwise exit the application without
saving . It seems Workbook_beforeSave is not working and gives the opetion of
savig. do you know that this idea is even possible?
--
Best regards,
Edward


"Barb Reinhardt" wrote:

You could add some Workbook_BeforeSave code to the workbook. I can't seem
to find a good reference now, but you should be able to find something by
Googling on it. Make sure you put this in the ThisWorkbook module.
--
HTH,
Barb Reinhardt



"Edward" wrote:

Hi everybody,
How can we intrupt Save and Save as in Excel ? I want to write my own code
instead of svaing a document when user clciks on save
--
Best regards,
Edward


Bob Umlas, Excel MVP

how to intrupt Save and Save as?
 
You can check for whatever you want to check in the Workbook_BeforeSave event
(which MUST be in the Thisworkbook code) and if it's not to be saved, simply
set
Cancel = True
Application.Quit (or Thisworkbook.Close False)

"Edward" wrote:

Thanks Barb, Basically my goal is to use the code to let the user to sort a
protected worksheet via vba ( I know have the code ) but the problem is user
can save the sorted workbook which im trying to avoid. I thought if I can
intrupt the save and save as then I can open a inputbox and if user gives a
correct password save the workbook otherwise exit the application without
saving . It seems Workbook_beforeSave is not working and gives the opetion of
savig. do you know that this idea is even possible?
--
Best regards,
Edward


"Barb Reinhardt" wrote:

You could add some Workbook_BeforeSave code to the workbook. I can't seem
to find a good reference now, but you should be able to find something by
Googling on it. Make sure you put this in the ThisWorkbook module.
--
HTH,
Barb Reinhardt



"Edward" wrote:

Hi everybody,
How can we intrupt Save and Save as in Excel ? I want to write my own code
instead of svaing a document when user clciks on save
--
Best regards,
Edward



All times are GMT +1. The time now is 02:25 AM.

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