View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Programmatically determining if workbook is opened as Read Only

Seems to work OK

Private Sub Workbook_Open()
If ThisWorkbook.ReadOnly = True Then
MsgBox "This book is read only."
Else
MsgBox "Run"
'run your macro
End If
End Sub

Mike

"Barb Reinhardt" wrote:

I have a data extraction macro that I run monthly and it takes a while to
run, so I periodically open it in another Excel instance as Read Only during
the extraction to get an indication on how much is left to extract.
Unfortunately, I also have a workbook open event that asks if I want to run
the macro, which fires whether it's read only or not. I don't want this
message displayed if the workbook is opened as read only. Is there some way
to do that?

Thanks,
Barb Reinhardt