+ Reply to Thread
Results 1 to 6 of 6

Disable save without password

  1. #1
    Registered User
    Join Date
    05-30-2017
    Location
    Portugal
    MS-Off Ver
    2016
    Posts
    3

    Disable save without password

    Hi everyone.

    First post, but I come here a lot to learn from you guys. I came across a few awesome bits of code, and have been trying to frankenstein it together.

    The purpose is to stop users to save the excel file. When the user tries to save, a userform appears asking for a password. If the password is correct, the workbook is saved. If the password is incorrect, a message appears saying "Wrong Password".

    However, for some reason, it still saves the workbook when the password is incorrect... Here is the code:

    Please Login or Register  to view this content.
    The code above clears the texbox, and then makes the userform3 appear before saving. The userform has a textbox, a commandbutton and an exit button.

    Please Login or Register  to view this content.
    The code above is what happens when you press the command button.

    Please Login or Register  to view this content.
    The code above does not allow to save when exit is pressed.

    Please Login or Register  to view this content.
    The code above makes pressing enter the same as clicking the command button.

    Any input would be greatly apreciated.
    Thanks in advance!

    Filipe

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Disable save without password

    Why not just save the WB as read only? If user has PW, they can open it with that. Otherwise, they can do what they want in the file, but cannot save it
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    05-30-2017
    Location
    Portugal
    MS-Off Ver
    2016
    Posts
    3

    Re: Disable save without password

    Hi FDibbins

    Thanks for the quick reply.

    I'm not sure about what that "read only" mode does. Will it allow the user to insert data and run macros? That's kind of the point of this workbook: to be a calculator tool..

    Thanks in advance!"

    Filipe

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Disable save without password

    When you save the file, use Save As, then click Tools (down the bottom of the window), select General, and use Password To Modify

    The user canthen open the file (as Read Only) and do anything/everything they want/need to, change data, add/delete stuff, run macros etc, but they just cannot save it
    If they know the PW and enter it on opening the file, then they can also save the file

  5. #5
    Registered User
    Join Date
    05-30-2017
    Location
    Portugal
    MS-Off Ver
    2016
    Posts
    3

    Re: Disable save without password

    Awesome! It works perfectly, and it is much simpler than my previous implementation!

    Thank you very much!

    Have a nice day

    Filipe

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Disable save without password

    Simple is always better

    Happy to help and thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA Macro to enable Save option without a password but enable Save As with password
    By WuonAlice in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-19-2016, 12:54 PM
  2. How to Save As a password-to-open workbook without a password?
    By ncalkins in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-05-2012, 07:02 PM
  3. Disable save and save as upon opening a certain workbook
    By Tino XXL in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2011, 01:49 PM
  4. Disable Save/Save As in Excel 2010
    By toddp in forum Excel General
    Replies: 2
    Last Post: 09-22-2011, 03:36 AM
  5. excel disable save but enable with password prompt?
    By techmob in forum Excel General
    Replies: 6
    Last Post: 06-17-2011, 03:11 PM
  6. Disable Save As and Save - enable Save via button
    By LampCommandr in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-07-2011, 05:42 PM
  7. disable save and saveas but have submit button to save file as work
    By briant97 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-04-2010, 12:32 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1