Hi,
I've been battleing over this for sometime now. I've created a custom ribbon with a range of buttons and dropdown menus. So far I have been able to get code to run when using OnAction commands for buttons, but I am now trying to use Callbacks to change the enabled state of a dropdown or change the item selected in the dropdown - but this whole business of callbacks and how to use them is really confusing me.
For example I am trying to enable a dropdown called Audience when the sheet called Audience is selected.
This is my code for the Callback
And this is the code I have when the sheet Audience is selected.
I get an 'Argument not Optional' error when trying to run this Worksheet_Activate code, which from what I've been able to find out online has something to do with the ByRef argument given in the AudienceGetEnabled sub.
I also thought this might work on the Worksheet_Activate code but I get an Object required error
Any help would be greatly appreciated.
Thanks
I've been battleing over this for sometime now. I've created a custom ribbon with a range of buttons and dropdown menus. So far I have been able to get code to run when using OnAction commands for buttons, but I am now trying to use Callbacks to change the enabled state of a dropdown or change the item selected in the dropdown - but this whole business of callbacks and how to use them is really confusing me.
For example I am trying to enable a dropdown called Audience when the sheet called Audience is selected.
This is my code for the Callback
Code:
Public Sub AudienceGetEnabled(control As IRibbonControl, ByRef returnedVal)
'
' Code for getEnabled callback. Ribbon control dropDown
'
If ActiveSheet.Name = "Audience" Then
returnedVal = Enabled
End If
End Sub
And this is the code I have when the sheet Audience is selected.
Code:
Private Sub Worksheet_Activate()
AudienceGetEnabled
End Sub
I get an 'Argument not Optional' error when trying to run this Worksheet_Activate code, which from what I've been able to find out online has something to do with the ByRef argument given in the AudienceGetEnabled sub.
I also thought this might work on the Worksheet_Activate code but I get an Object required error
Code:
Private Sub Worksheet_Activate()
control.AudienceGetEnabled.returnVal = Enabled
End Sub
Any help would be greatly appreciated.
Thanks