auto open workbook to make read-only
Thanks for the help but this does not suppress the initial dialogue box
asking to read only or not. Also sub auto-open() does not work for me whereas
sub workbook auto_open does? Why is this? The only way I can get around this
is not to have the workbook saved password protected or readonly but make it
readonly automatically on the auto-open using the code:
Private Sub Workbook_Open()
ThisWorkbook.ChangeFileAccess xlReadOnly
End Sub
Cheers, Tim
ryguy7272" wrote:
For an old post:
Option Explicit
Sub auto_open()
Dim resp As Long
If ThisWorkbook.ReadOnly = True Then
'they opened it readonly
'do nothing
Else
resp = MsgBox(Prompt:="What to change it to readonly?", _
Buttons:=vbYesNo)
If resp = vbYes Then
ThisWorkbook.ChangeFileAccess xlReadOnly
End If
End If
End Sub
Hit Alt+F11, double-click 'ThisWorkbook' and paste the code in there.
Finally, File|SaveAs|tools|general options|check that "read-only recommended"
box.
Good luck,
Ryan---
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
"Tim C" wrote:
I want to manually open a protected workbook and for it to open read-only
with out a dialog box.
If the above requires the use of the auto_open event, how do I turn this off
when I open the protected workbook programmatically?
I'm using excel 2003
|