Prevent Vba Code From Running While In Read Only Mode

less than 1 minute read

Sub ReadOnlyCheck()
    Dim Answer As Long
    'Check to see if file is Read-Only
    If ThisWorkbook.ReadOnly = TRUE Then Answer = MsgBox("Someone Is currently editing this file And your changes will Not be saved. " _ &
    "Do you wish To proceed?", vbYesNo, "Read-Only File")
    If Answer = vbNo Then Exit Sub
  End If
End Sub