+ Reply to Thread
Results 1 to 3 of 3

Not Save "Read Only" file via Macro

Hybrid View

  1. #1
    Registered User
    Join Date
    12-24-2008
    Location
    Oosterhout, the Netherlands
    Posts
    5

    Not Save "Read Only" file via Macro

    Hi,

    I build a file in which the user starts with a Macro that hides All Toolbars, and disabled the possibility to close the file with the red X.
    The user has to use a Macro to close the file.

    This Macro re-installs the Toolbars, enables the Red X. Returns to the start-up sheet, Saves the file and Closes it.

    This works perfectly, but the file has to be protected with a Password to Modify as only a few persons are allowed to make changes.

    The problem is that other users are allowed to open the file as a "read only" file, and now I have a conflict if these users want to close the file with the Macro. As it cannot save it.

    I can of course cut the Macro in two where one macro Saves the File and the other does all the other actions, but I was hoping that someone can help me with a code that leaves the functionality of the existing Macro as it is, but will recognize that it is dealing with a read only version so it will avoid the save part. (or something like that)

    Thanks in advance for your assistance.
    Kind regards
    Rough

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492
    If you don't want to change your original macro, nor post anything here for us to look at, an additional macro would be needed, yes?

    Create a macro for those users that get to enter a password and make changes. The macro asks for their password, if it is correct, then it unprotects the sheet AND reenables saving capability, perhaps through another macro button onscreen if you wish.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    You can test the ReadOnly property of the workbook before trying to save.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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