View Full Version : Macro to open workbook read only
Hello, how do I set the read only attribute when opening a workbook? Please see the code below (does not currently work). :banghead: Thank you!
Private Sub Workbook_Open()
ThisWorkbook.ReadOnly = True
End Sub
lucas
01-15-2009, 08:04 PM
Set wb = Workbooks.Open("f:\Temp\Social Club.xls", True, True)
Should this be copied in the Sub Workbook_Open sub? Thank you.
chex,
I think you are trying to have the workbook change itself to Read-Only. If this is correct, no real testing, but try:
Private Sub Workbook_Open()
ThisWorkbook.ChangeFileAccess Mode:=xlReadOnly
End Sub
Hope this helps,
Mark
Thank you Mark, that works! Only now it asks me if I want to save the file before changing the status - what can I do to eliminate that prompt? Thank you again.
Thank you Mark, that works! Only now it asks me if I want to save the file before changing the status - what can I do to eliminate that prompt? Thank you again.
Sorry, I am missing what you are saying. Upon initially adding this to the Open event, I presume it saved okay. After closing - I would also expect the workbook to open w/o anything popping up. What exactly are you saying is happening (and when)?
Mark
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.