VB code to tell if my sheet is read-only

K

Kevin

Hi

I want to run code only if the workbook is live (ie not read-only). I have
set the workbook to advise users to open it read only but If they choose to
open edit then I want to force a close after 2 hours ( I have the code for
this).

is this very simple?
 
C

carlo

Hi Kevin

Try this:

Private Sub Workbook_Open()

If Not ActiveWorkbook.ReadOnly Then
'your code to close the book in 2 hrs
End If

End Sub

hth

Carlo
 
Top