Name

worksheet.ProtectContents

Synopsis

Returns True if the worksheet’s contents are protected; otherwise, returns False. The following code displays the types of protection applied to a worksheet in the Immediate window:

    Set ws = ThisWorkbook.Sheets("Protection")
    Debug.Print "Protections on workbook:"
    Debug.Print "Contents?", "Controls?", "UI?", "Scenarios?"
    Debug.Print ws.ProtectContents, ws.ProtectDrawingObjects, _
      ws.ProtectionMode, ws.ProtectScenarios

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.