none
VBA code to block users from overwritting my Excel project file

    Question

  • I actually want a VBA code to block users from overwritting my project file when using the Save As option from this code:

    Application.Dialogs(xlDialogSaveAs).Show

    My Project file needs to remain in Compiled folder as the base file that the users will use to create another file. 

    I am really trying to avoid a situation, where the user will make a mistake to overwrite the base file.  So I want a code that will come up with message such as "Sorry you cannot Overwrite this file 'Project.xlsm' please use another filename."

    The Code I used to make User Save As is : Application.Dialogs(xlDialogSaveAs).Show ---- So I will want a code that would work with this.

    Thanks in anticipation of your generous assistance.
    Thursday, August 16, 2012 8:02 PM

Answers

  • A relatively simple way is to navigate to the file in Windows Explorer.

    Right click the file and select properties.

    Set to Read only.

    Then when the user attemps to save they get a message to change the file name.


    Regards, OssieMac

    • Marked as answer by Eni4real Tuesday, September 04, 2012 9:10 PM
    Friday, August 17, 2012 12:02 AM