PDA

View Full Version : Solved: Detect if workbook is Read Only



lifeson
06-12-2009, 03:03 AM
Is there a vba method for determining if the open workbook is in a read only state? (other than reading the detail in the caption bar :) )

Simon Lloyd
06-12-2009, 03:08 AM
in the workbooks open event:

If thisworkbook.readonly = true then
msgbox"Workbook is read only!"
end if

lifeson
06-12-2009, 03:13 AM
Found it!

Dim rOnly As Boolean
rOnly = Application.ActiveWorkbook.ReadOnly
If rOnly = True Then
MsgBox "File is Read Only - Cannot be saved"
Exit Sub
Else
End If

lifeson
06-12-2009, 03:15 AM
Thanks Simon! even easier

Simon Lloyd
06-12-2009, 04:30 AM
If this has been solved for you please mark it solved by going to THREAD TOOLS and MARK SOLVED