+ Reply to Thread
Results 1 to 5 of 5

macro to disable/enable read only

  1. #1
    Forum Contributor
    Join Date
    03-12-2018
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    118

    macro to disable/enable read only

    Hello
    I have an excel file which is password protected for modification. I do know the password however I often prefer to open it as read only, since I need to format tables and columns and use filters, to avoid the risk to save it over by mistake.

    However, it could be that sometimes I am on read-only mode but I realise I want to save the changes I just did, and of course I cannot, so I need to close the file, open it again with the password and re-do all the changes. Save. Close again and re open as read only.

    I wonder if there is a way to have a macro that I can launch whilst on read-only mode that temporarily disable the read-only mode, save the file, puts back the read only mode (password protected).


    I found the below code but it does not save the file back as read-only
    Please Login or Register  to view this content.
    Anyone that can help me on this?
    thanks everyone
    Last edited by alansidman; 04-12-2018 at 10:54 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,885

    Re: macro to disable/enable read only

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: macro to disable/enable read only

    Good afternoon thoandros
    Quote Originally Posted by thoandros View Post
    I wonder if there is a way to have a macro that I can launch whilst on read-only mode that temporarily disable the read-only mode, save the file, puts back the read only mode (password protected).
    I don't think so.

    When you open a file in read-only mode, you can use Save As - but it needs to be a different file name. Add a 1 (or any character to the file name). When you've finished, delete the original file, and remove the extra character from the newly saved file.

    Sure, it's a bit of a faff, but it works, and it's probably quicker than what you do now.

    HTH

    DominicB

  4. #4
    Forum Contributor
    Join Date
    03-12-2018
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    118

    Re: macro to disable/enable read only

    Hi,
    I cannot do that because loads of other files have references to this this file.

  5. #5
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: macro to disable/enable read only

    Hi thoandros

    Are they all open at the same time your read-only file is open?
    If they are then you cannot do this and you will have to revert back to doing it your old way.*
    If they are not, then it's irrelevant - the file name will not change, and the next time they are opened will read from the new file.


    * Try this with copied files (not the originals, till you get the hang of it), but you could turn off automatic calculation, perform the steps I describe, then switch back to automatic calculation. In theory, this should work.

    HTH

    DominicB

+ 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. Getting rid of Enable/Disable Macro prompt on launch
    By vickyho1008 in forum Excel General
    Replies: 2
    Last Post: 05-22-2007, 10:05 PM
  2. Stopping Disable/Enable Macro Message
    By Jenno in forum Excel General
    Replies: 2
    Last Post: 02-13-2007, 09:54 AM
  3. enable and disable macro
    By BillyRogers in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-20-2006, 04:50 PM
  4. enable/disable macro
    By RICK in forum Excel General
    Replies: 4
    Last Post: 06-15-2006, 03:00 PM
  5. [SOLVED] Macro Enable/Disable
    By Marcus B in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-22-2006, 10:55 AM
  6. disable and enable macro execution using VBA in another workbook?
    By keithb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2005, 02:05 PM
  7. [SOLVED] Enable - Disable Macro Dialog Box
    By Terry in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-23-2005, 12:05 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