Consulting

Results 1 to 10 of 10

Thread: Disable Save As option

  1. #1

    Disable Save As option

    I want the Save As option to be disabled in the excel file.
    Can you let me know how this can be done?

    Raj

  2. #2
    VBAX Tutor phendrena's Avatar
    Joined
    Oct 2008
    Location
    Huddersfield, UK
    Posts
    285
    Location
    [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.

  3. #3
    Thank you so much

  4. #4
    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?

  5. #5
    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?

  6. #6
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Quote Originally Posted by rajagopal
    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?
    Quote Originally Posted by rajagopal
    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

  7. #7
    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.

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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

  9. #9
    What is VBEIDE?

  10. #10
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •