For several years I have used the following code to disable/enable commandbar controls, but since updating to Excel 2016 for Mac it no longer works:
The call to above procedure is:
Does anyone know why this no longer works?
Code:
' Controls the enabling/disabling of all controls with the specified Id.
Private Sub EnableControl(pintCtrlId As Integer, pbooEnable As Boolean)
Dim pbarCmdBar As CommandBar
Dim pctlCmdBarCtrl As CommandBarControl
' Error handler needed.
On Error Resume Next
' Finds every command bar control with the specified Id and enables/disables it according to the setting of pbooEnabled.
For Each pbarCmdBar In Application.CommandBars
Set pctlCmdBarCtrl = pbarCmdBar.FindControl(Id:=pintCtrlId, recursive:=True)
If Not pctlCmdBarCtrl Is Nothing Then
pctlCmdBarCtrl.Enabled = pbooEnable
End If
Next pbarCmdBar
On Error GoTo 0
' Destroys object reference.
Set pctlCmdBarCtrl = Nothing
End Sub
The call to above procedure is:
Code:
EnableControl mconCtrlID_PasteSpecial, False
Does anyone know why this no longer works?