AllowHeadingRename Property

Microsoft Office Web Components Visual Basic

expression.AllowHeadingRename

expression    Required. An expression that returns a Protection object.

Remarks

Setting the Caption property of a row or column heading after setting this property to False results in a run-time error. You must set the Enabled property of the Protection object to True for this property to take effect.

Example

This example locks all cells on Sheet1, enables the insertion and deletion of columns, disables the customization of row and column headings, and then protects Sheet1.

Sub Protect_Worksheet()

    Dim ptProtSheet1

    'Lock all cells on the worksheet.
    Spreadsheet1.Worksheets("Sheet1").Cells.Locked = True

    Set ptProtSheet1 = Spreadsheet1.Worksheets("Sheet1").Protection

    ' Allows user to delete columns while Sheet1 is protected.
    ptProtSheet1.AllowDeletingColumns = True

    ' Allows user to insert columns while Sheet1 is protected.
    ptProtSheet1.AllowInsertingColumns = True

    ' prevent row and column headings from being customized.
    ptProtectSheet1.AllowHeadingRename = False

    ' Protect Sheet1.
    ptProtectSheet1.Enabled = True

End Sub