View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Do not let user save template if it has been been modified

Maybe you could just use the workbook_beforeSave event:

Option Explicit
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = True
End Sub

Remember that if macros are disabled--or events disabled--then this won't help.

And you'll want to find a way to save your file when you make updates--maybe use
a macro that turns off events, does the save, and reenables events.

Option Explicit
sub SaveMeNow()
application.enableevents = false
activeworkbook.save
application.enableevents = true
end sub

==
and any user could do the same kind of thing, too.

Maddoktor wrote:

Hi all,

I have a template that I do not want it to be saved under any
circumstances when any part of it is modified. I have been able to
program the X button not to save with:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Saved = True
End Sub

but not sure what coding is needed so it will not save if the user click
the save button or chooses the file|save or file|save as option from the
menu item.

Thanks in advance.


--

Dave Peterson