View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Bob Umlas, Excel MVP Bob Umlas, Excel MVP is offline
external usenet poster
 
Posts: 320
Default 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