PDA

View Full Version : Disable Save As option



rajagopal
10-31-2008, 05:58 AM
I want the Save As option to be disabled in the excel file.
Can you let me know how this can be done?

Raj

phendrena
10-31-2008, 06:04 AM
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI Then
MsgBox ("The 'Save As' function has been disabled."), vbInformation, "Save As Disabled"
Cancel = True
End If
End Sub

Place that in the "ThisWorkbook" area :)

rajagopal
10-31-2008, 07:55 AM
Thank you so much

rajagopal
10-31-2008, 08:09 AM
User cannot modify the codes other than the owner. How can this be done?
currently, user can use Copy, paste function in the excel or they can delete the codes.
How to restrict this?

rajagopal
10-31-2008, 08:15 AM
Also, the codes given above is not working fine for the users who use Excel 2007 format. they can use Save As option.
How can we restrict?

GTO
10-31-2008, 09:11 PM
User cannot modify the codes other than the owner. How can this be done?
currently, user can use Copy, paste function in the excel or they can delete the codes.
How to restrict this?


Also, the codes given above is not working fine for the users who use Excel 2007 format. they can use Save As option.
How can we restrict?

In the first one, you appear to be talking about a user overwriting worksheet formulas when you mention "codes". In the later msg, you appear to talking about vba code when you mention "codes". If I am correctly ascertaining this, you can see where this gets confusing, calling two totally different things by the same name.

If I did correctly 'get' what you are asking in the two questions:

SaveAs enforcement:

Really what you need to worry about here is enforcing that the user enables macros. No matter what, if macros are disabled, the user will be able to SaveAs. There are several posts and KB articles dealing with this.

Cut/Paste/Overwriting Formulas:

To actually successfully prevent use of cut/copy/paste, you would not only have to insist on enabling macros, but modify toolbars and the menubar (disabling commands), or build a custom menubar (along w/any wanted toolbars), while hiding most app toolbars (including the toolbar known as "Toolbar List" or something close to that) as well as disable several shortcut key combinations... all of which will need reversed whenever another workbook is selected, and/or your workbook closes.

While occassionally these efforts are worth it, I would first suggest unlocking the cells on the sheet that you want the user to be able to enter/edit data in, leaving the cells locked that have your formulas entered, and protect the sheet.

Hopefully this helps,

Mark

rajagopal
11-05-2008, 12:38 AM
Sorry for the confusion.
My query is user can access VBA codes by right clicking in the sheet name and clicking view code (they can use tools>macros>edit option also) and they can delete the codes.
My requirement is the user should not get access to the VBA codes.

Bob Phillips
11-05-2008, 01:56 AM
Password protect the project in the VBEIDE.

rajagopal
11-05-2008, 02:00 AM
What is VBEIDE?

Bob Phillips
11-05-2008, 02:45 AM
The VBA integrated development environment (Alt-F11 from Excel).