+ Reply to Thread
Results 1 to 6 of 6

Workbook Open ReadOnly

  1. #1
    Registered User
    Join Date
    02-10-2011
    Location
    Copenhagen, DK
    MS-Off Ver
    Excel 2007
    Posts
    30

    Workbook Open ReadOnly

    Hi y'all,

    Situation
    I have a Excel Report publication system where the "Master-Report" Saves copies of itself. From the Master-Report I can then publish the Reports by Copy-Paste the copies to a public server.

    On our Intranet I have HTML links to the files on the public server. The reports always has the same name on the server. This way i can overwrite the old reports and the HTML links does not have to be changed.

    Workflow:

    Local drive: Master Report.xlsm --> Local drive: Report DK Jan 11 --> Public server: Report DK <-- Intranet:HTML Link

    When publishing the reports to the public server, I use this code:
    Please Login or Register  to view this content.
    Problem
    I want the published reports to be opened in ReadOnly, this way readers cannot write in the reports, and I can allways replace the reports with new reports, even if they are opened by other users.
    But if I make the files ReadOnly I cannot overwrite them with new publications, I will have to delete the old reports manually before publishing the new ones.
    How can I solve this Dilemma?

    Possible solutions
    1. In VBA I have a code which automatically makes the Excel reports ReadOnly. Something like:
    Please Login or Register  to view this content.
    Does such a code exist?

    2. If it is possible to implement some kind of feature into the HTML Link which forces the reports to open in ReadOnly mode.


    Is this clear? Do you guys have any alternative solutions? Or know how to create one of the solutions mentioned above?

    Kind Regards
    KRAND
    Last edited by KRAND; 02-28-2011 at 08:38 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Workbook Open ReadOnly

    Hi,
    You could try
    ActiveWorkbook.ChangeFileAccess Mode:=xlreadonly
    ActiveWorkbook.ChangeFileAccess Mode:=xlreadwrite

    or you could use the filesystemobyect on a colsed file - attribute 1 for readonly or 0 for write
    so c:file.ext,1,false

    hope this helps


  3. #3
    Registered User
    Join Date
    02-10-2011
    Location
    Copenhagen, DK
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Workbook Open ReadOnly

    Hi D_Rennie

    I have tried to use the file system object, but i do not know how. could you give an example?

    Please Login or Register  to view this content.
    Kind Regards
    KRAND
    Last edited by KRAND; 02-28-2011 at 05:19 AM.

  4. #4
    Registered User
    Join Date
    02-10-2011
    Location
    Copenhagen, DK
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Workbook Open ReadOnly

    Quote Originally Posted by D_Rennie View Post
    Hi,
    You could try
    ActiveWorkbook.ChangeFileAccess Mode:=xlreadonly
    ActiveWorkbook.ChangeFileAccess Mode:=xlreadwrite

    or you could use the filesystemobyect on a colsed file - attribute 1 for readonly or 0 for write
    so c:file.ext,1,false

    hope this helps
    Hi,

    Could you give an example of how to use the filesystemobject to change a file to readonly?

  5. #5
    Registered User
    Join Date
    02-10-2011
    Location
    Copenhagen, DK
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Workbook Open ReadOnly

    I solved the problem with this code!:

    Please Login or Register  to view this content.
    Kind Regards
    Kristoffer

  6. #6
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Workbook Open ReadOnly

    glad you got this sorted and am happy with it, honestly i forgot about this thread.

+ 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