i'm tryin to add in this 2 vba codes - the first to workbook open event and the second is to workbook before close event
Sub workbook_open()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=522)
Ctrl.Enabled = False
Next Ctrl
End Sub
Sub workbook_beforeclose()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=522)
Ctrl.Enabled = True
Next Ctrl
End Sub
i can't seem to make the vba code work correctly when opening and closing the workbook.
- am i missing something?
Sub workbook_open()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=522)
Ctrl.Enabled = False
Next Ctrl
End Sub
Sub workbook_beforeclose()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=522)
Ctrl.Enabled = True
Next Ctrl
End Sub
i can't seem to make the vba code work correctly when opening and closing the workbook.
- am i missing something?