+ Reply to Thread
Results 1 to 7 of 7

Force read only / acquire write permission

  1. #1
    Forum Contributor
    Join Date
    02-26-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    173

    Thumbs up Force read only / acquire write permission

    Hello Excelforum!

    I have a collection of macros that I share with other computers on my network. The macros is shared on a network drive accessible to both computers stored at Z:\Excel Macros\smpitaReports.xlam as an Add-in file. I am constantly updating and tweaking the macros but whoever is the first person to open their Excel gets write permission and the rest of us get read permission. I need to figure out a way to control this without changing network/filesystem permissions.

    I figure the best way to do this is to make everyone open the file as read only by default and then when I need to make updates to it, run a macro to acquire write access. Can this be done in VBA? I have access to each terminal Excel so I can put in a startup macro to check for write access and then drop to read only if write access is found. I started to try to piece it together from searching the internet but I'm hitting a brickwall at the start. This is as far as I've gotten which is a failed attempt at a basic check for read only access that gives me an "Object Required" error.

    Please Login or Register  to view this content.
    Is there an easier way to do this? Ideas are welcome.

    Thank you for your time!

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,591

    Re: Force read only / acquire write permission

    Untested, but try:

    Please Login or Register  to view this content.
    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    02-26-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    173

    Re: Force read only / acquire write permission

    Hello TMS!

    Thank you for your attention to my thread! I get the error "This workbook is currently referenced by another workbook and cannot be closed" on the line
    Please Login or Register  to view this content.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,591

    Re: Force read only / acquire write permission

    Looks like you got your object but it's in use.

    Sorry, I don't know what else to suggest.

  5. #5
    Forum Contributor
    Join Date
    02-26-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    173

    Re: Force read only / acquire write permission

    Thanks TMS!

  6. #6
    Forum Contributor
    Join Date
    02-26-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    173

    Re: Force read only / acquire write permission

    With more research, I have decided to change my deployment method. I mostly followed the guidelines on another site, keeping the development copy on my computer and pushing a read only copy to the network share for others to use. I used the following code template:
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    02-26-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    173

    Re: Force read only / acquire write permission

    Closing thread and marking as solved.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,591

    Re: Force read only / acquire write permission

    Excellent! Thanks for sharing your solution. Very much appreciated.

    Thanks for the rep.

    Regards, TMS

+ 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. Replies: 0
    Last Post: 07-24-2014, 08:59 PM
  2. [SOLVED] Checking to see if a file has been opened in Read/Write or Read Only
    By brokenbiscuits in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-13-2014, 09:16 AM
  3. Replies: 2
    Last Post: 02-11-2013, 08:44 AM
  4. Set permission to change and read-only file in dropbox
    By ioncila in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-12-2012, 06:01 AM
  5. How can a file be converted from Read-Only to Read/Write
    By Jim in Apopka in forum Excel General
    Replies: 2
    Last Post: 11-19-2005, 01:00 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