+ Reply to Thread
Results 1 to 9 of 9

Save a workbook in read only

  1. #1
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Question Save a workbook in read only

    Hi All,

    i need a way to alter the state of a workbook to "editable" then save and then switch back to "read only"

    reason being is i need to hide tabs evertime the workbook is closed

    any ideas are more than welcome

    cheers for reading
    Last edited by Macdave_19; 04-23-2009 at 06:34 AM.
    Mr MaGoo
    Magoo.Inc MMVII

    If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post

  2. #2
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: Save a workbook in read only

    You could just place a macro to hide the tabs when the book is saved then, why do you need to make it read only?
    Something like this in the 'ThisWorkbook' section of the VB Editor will hide teh sheets for you when saving:

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Re: Save a workbook in read only

    Nah phil,

    you can't save the workbook in read only mode mate!

  4. #4
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: Save a workbook in read only

    No, my question was more one of "Why do you need to make it read-only?"
    Your original post gives the reason as needing to hide the tabs when you close the workbook, hence my original suggestion.

    So are you wanting to hide the tabs and make it read-only when it is closed / saved ?
    Then when you open it, manually make it editable again, and manually unhide the tabs?

  5. #5
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Re: Save a workbook in read only

    right,

    when a user opens the workbook they can either open it as read only or enter the password and edit it.

    my workbook_open macro checks to see if it's read only or editable then undides the tabs if editable or hides if not editable.

    my dilema come when people are prompeted to enable macro's at the begining.

    if all tabs are visible when closed then it's pointless, hence the reason i want to be able to hide all tabs in read only, when saved.

    i hope that's clear

  6. #6
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: Save a workbook in read only

    How about this then?
    On 'Save' it hides Worksheets 2 & 3, and saves the file with a readonly password set.
    Password is "MaGoo"

    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Thumbs up Re: Save a workbook in read only

    actually i've just sussed it!

    if the workbook is editable then i can simpy hide the tabs then save meaning if it's opened without a password they will be hidden.

    if the workbook is read only i don't need to save it as it'll already be hidden

    your idea kind of cleared my mind for me there!!

    this should work.

    cheers

  8. #8
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: Save a workbook in read only

    Correct, the above code will do what you need on a 'editable' workbook that is saved, and a readonly workbook can't have the tabs unhidden and saved anyway

    Only thing that could 'break' this would be if someone opened it with write access, (using the password), but then didn't enable macros. If they then unhide the tabs, and save the workbook they will remain visible until the next time someone opens it with Write access and enables the macros, and saves
    Not overly likely to happen, but just a possibility for you to look out for

  9. #9
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Re: Save a workbook in read only

    i've thought of this and the only tab that isn't hidden is an info screen reminding folk to enable them and also a button for those who know the passowrd and want to edit it

    cheers for your help

+ 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