kashif.special2005
Active Member
- Joined
- Oct 26, 2009
- Messages
- 443
Hi,
I have a code in the Workbook_Open event, that is making the workbook as ReadOnly, but some time it works and some time not.
I noted one thing that when I opened the workbook, there is a message shows "This file originated from an Internet location and might be unsafe. Click for more details" and beside this message there is a button with caption "Enable Editing", when I clicked on this button it generate an error message and code stops.
Error Message:
Run-time error '1004'
Application-defined or object-defined error
Thanks
Kashif
I have a code in the Workbook_Open event, that is making the workbook as ReadOnly, but some time it works and some time not.
I noted one thing that when I opened the workbook, there is a message shows "This file originated from an Internet location and might be unsafe. Click for more details" and beside this message there is a button with caption "Enable Editing", when I clicked on this button it generate an error message and code stops.
Error Message:
Run-time error '1004'
Application-defined or object-defined error
Code:
If Not ThisWorkbook.ReadOnly Then 'Error Showing Here
Application.DisplayAlerts = False
ThisWorkbook.ChangeFileAccess Mode:=xlReadOnly
Application.DisplayAlerts = True
End If
Thanks
Kashif
Last edited: