I want the Save As option to be disabled in the excel file.
Can you let me know how this can be done?
Raj
I want the Save As option to be disabled in the excel file.
Can you let me know how this can be done?
Raj
[VBA]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[/VBA]
Place that in the "ThisWorkbook" area
Somewhere in the dark and nasty regions where nobody goes, stands an ancient castle.
Deep within this dank and uninviting place lives Berk, overworked servant of The Thing Upstairs.
But thats nothing compared to the horrors that lurk beneath The Trap Door.
Thank you so much
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?
Originally Posted by rajagopalIn 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.Originally Posted by rajagopal
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
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.
Password protect the project in the VBEIDE.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
What is VBEIDE?
The VBA integrated development environment (Alt-F11 from Excel).
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber