VB code to tell if my sheet is read-only

  • Thread starter Thread starter Kevin
  • Start date Start date
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?
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top