Hi,
How do you hide the menu items related to inserting and deleting rows and columns?
I have the following macro, but it only works about half the time and I don't know why. When it doesn't, I get the error:
"Run time error 5: Invalid procedure or call argument" in both xl2003 and 2010.
Sub HideMenuItems()
With Application.CommandBars("Row")
.Controls("Insert").Enabled = False
.Controls("Delete").Enabled = False
End With
With Application.CommandBars("Column")
.Controls("Insert").Enabled = False
.Controls("Delete").Enabled = False
End With
With CommandBars("Worksheet Menu Bar")
.Controls("Insert").Controls("Rows").Enabled = False
.Controls("Insert").Controls("Columns").Enabled = False
.Controls("Insert").Controls("Cells").Enabled = False
.Controls("Edit").Controls("Delete").Enabled = False
End With
End Sub
Thanks,
Lawrence
Bookmarks