Saturday, 18 July 2015

Enable/Disable Insert related functions

This macro can be used to enable / dis-able insert and other relevant controls. TRUE is for enable, false is for diable

 

    Application.EnableEvents = True

    With Application

        .Caption = ""

       

        'Cut

        .CommandBars("Worksheet Menu Bar").Controls("Cut").Controls("Rows").Enabled = True

        .CommandBars("Row").Controls("Cut").Enabled = True

       

        .CommandBars("Column").Controls("Cut").Enabled = True

        .CommandBars("Worksheet Menu Bar").Controls("Cut").Controls("Columns").Enabled = True

       

        .CommandBars("Standard").Controls.Item("Cut").Enabled = True

        .CommandBars("Edit").Controls.Item("Cut").Enabled = True

        .CommandBars("Cell").Controls.Item("Cut").Enabled = True

 

        'Insert

        .CommandBars("Row").Controls("Insert").Enabled = True

        .CommandBars("Worksheet Menu Bar").Controls("Insert").Controls("Rows").Enabled = True

        .CommandBars("Worksheet Menu Bar").Controls("Insert...").Controls("Rows").Enabled = True

       

        .CommandBars("Column").Controls("Insert").Enabled = True

        .CommandBars("Worksheet Menu Bar").Controls("Insert...").Controls("Columns").Enabled = True

        .CommandBars("Worksheet Menu Bar").Controls("Insert").Controls("Columns").Enabled = True

 

        .CommandBars("Cell").Controls.Item("Insert...").Enabled = True

       

        'Delete

        .CommandBars("Row").Controls("Delete").Enabled = True

        .CommandBars("Worksheet Menu Bar").Controls("Delete").Controls("Rows").Enabled = True

        .CommandBars("Worksheet Menu Bar").Controls("Delete...").Controls("Rows").Enabled = True

 

        .CommandBars("Column").Controls("Delete").Enabled = True

        .CommandBars("Worksheet Menu Bar").Controls("Delete").Controls("Columns").Enabled = True

        .CommandBars("Worksheet Menu Bar").Controls("Delete...").Controls("Columns").Enabled = True

        .CommandBars("Cell").Controls.Item("Delete...").Enabled = True

        

        'Other Properties Set

        .WindowState = xlMaximized

        .DisplayFormulaBar = True

        .Calculation = xlAutomatic

        .CellDragAndDrop = True

        .EnableEvents = True

        .MaxChange = 0.001

    End With

 

No comments:

Post a Comment