[Solved] VBA : Prevent Changes

  • In a shared workbook i don't want the other users tu use "Save As" option, only the "Save" option, o prevent that they can save the workbook with another name.


    In order to do that i use this code:


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


    Is it possible to do the same thing with the Tool/Option alternative?


    /Roger S

  • hi Stromma


    i think using the vba code is the best way to prevent saving the file directly.
    there is no option in the tools/option to prevent this (i think)


    cheers
    xlite

    Cheers
    ___________
    Xlite :sheep:
    [st]All you need to learn VBA is an internet connection and Ozgrid.com[/st]

  • Quote

    Originally posted by Stromma
    Is it possible to do the same thing with the Tool/Option alternative?


    /Roger S


    I assume you mean the "Tools/Options..." on the menu??? You could put the following code in the "ThisWorkbook" code



    That does what I understand you to want. If I misunderstood, sorry... Hope it helps!

  • Tanks for the tip jjst34!


    You was right about what i was looking for.


    I couldn't get the code to work, but with a small change it did:


    Private Sub Workbook_WindowActivate(ByVal Wn As Window)
    With Application.CommandBars("Tools")
    .Enabled = False
    End With
    End Sub


    Now it disable the whole "Tools" menu, and that's perfectly ok with me.


    Thanks Again!


    /Roger S

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!