Forcing Save Macro

  • Thread starter alex richardson
  • Start date
A

alex richardson

How can I force users to save via a macro which strips
away sensitive data before saving? Don't want them to be
able to use SAVE or SAVE AS to save the entire
spreadsheet. Making it read-only doesn't work, because it
allow users to save under a different name.
 
F

Frank Kabel

Hi
you can put some code in the BeforeSave event but this won't help if
the user simply disables macros
 
A

Alan

Apologies to you Alex, I mistakenly sent this you personally, this is a
copy,

To give you a start, this will prevent saving

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

To save the file once you've done this

Sub Saver ()
Application.EnableEvents = False
'Your code to remove sensitive data
ThisWorkbook.Save
Application.EnableEvents = True
End Sub

Bear in mind that if someone opens the file with macros disabled they can do
as they wish. You can use code to prevent the workbook from being opened
with macros disabled, but Excel security is easily overcome by anyone with a
little knowledge.

Regards,

----- Original Message -----
From: "alex richardson" <[email protected]>
Newsgroups: microsoft.public.excel.misc
Sent: Friday, August 06, 2004 7:21 PM
Subject: Forcing Save Macro
 
Top