View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default auto open workbook to make read-only

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