ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VB code to tell if my sheet is read-only (https://www.excelbanter.com/excel-discussion-misc-queries/172376-vbulletin-code-tell-if-my-sheet-read-only.html)

Kevin

VB code to tell if my sheet is read-only
 
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?
--
Kevin

carlo

VB code to tell if my sheet is read-only
 
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


On Jan 10, 8:59*am, Kevin wrote:
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?
--
Kevin




All times are GMT +1. The time now is 02:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com