View Full Version : Solved: Preventing a user from saving a file as a different name.
slang
05-29-2008, 11:14 AM
Is there a way to prevent a user from changing the name of a workbook by using ?saving as??
Would the code be inserted into the workbook/beforesave section?
Thanks once again???..:friends:
sai_golden
05-29-2008, 11:53 AM
Hi ,
The following code should work:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI Then Cancel = True
End Sub
Bob Phillips
05-29-2008, 12:12 PM
Maybe a slight change to force it as a normal save
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim sFile
If SaveAsUI Then
Application.EnableEvents = False
Cancel = True
ThisWorkbook.Save
End If
Application.EnableEvents = True
End Sub
grichey
05-29-2008, 02:43 PM
If the user's security is set to high, none of this matters anyways and they can save it however they like, correct?
Bob Phillips
05-29-2008, 03:20 PM
True, macros will be automatically disabled. Does anyone actually use that? I know some It departments impose a no-macro rule, but I bet not many people set it high themselves.
slang
05-30-2008, 03:30 AM
Thanks a lot again! It works perfect??:thumb
As for the Macro security setting, the user needs to have the macros enabled for the app to work for them anyway and I am only worried about the majority of the users not the ones that like to tear things apart to see how they work.
Those ones are pretty hard to control without a small (or large) electrical pulse that emanates from their keyboard when entering somewhere they shouldn?t be.:devil2:
Is that option under the application or workbook section? LOL
Thanks again for all your help?.. :beerchug:
grichey
05-30-2008, 07:55 AM
Yeah - I know both my former and current employers default excel to high security.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.