(I posted this elsewhere accidentally - apologies).
I am trying to set up a customised ribbon in Microsoft Project 2010. Most of of it works fine but I am unable to get my dropdown button to function. Specifically, I cannot get the index of the selected item (or the item number for that matter) to be returned.
I get an 'Automation Error' with the OnAction subroutine as shown below but if I remove the parameters, the routine fires but of course I cannot retrieve any selection information. I would really appreciate some guidance here. I have tried everything I have seen online but nothing has worked.
The relevant fragment of my XML code is: (I am getting VBA to generate the XML - hence the string-building form of the following line)
ribbonXml = ribbonXml + "<mso:dropDown id = ""AddModule"" imageMso = ""ModuleInsert"" getItemLabel = ""SetLabel"" onAction = ""DoSomething"" > "
and the callback routines are:
Sub DoSomething(control As IRibbonControl, SelectedID As String, SelectedIndex As Integer)
MsgBox (control.id) 'just to see if I can retrieve anything
ChosenItemID = SelectedID 'hoping this will contain the selected id
End Sub
and (do I really need this?)
Sub SetLabel(control As IRibbonControl, index As Integer, ByRef returnedval)
returnedval = ChosenItemID 'because this is what some post I read said to do
End Sub
ChosenItem is set up as a global variable in the module.
With thanks
I am trying to set up a customised ribbon in Microsoft Project 2010. Most of of it works fine but I am unable to get my dropdown button to function. Specifically, I cannot get the index of the selected item (or the item number for that matter) to be returned.
I get an 'Automation Error' with the OnAction subroutine as shown below but if I remove the parameters, the routine fires but of course I cannot retrieve any selection information. I would really appreciate some guidance here. I have tried everything I have seen online but nothing has worked.
The relevant fragment of my XML code is: (I am getting VBA to generate the XML - hence the string-building form of the following line)
ribbonXml = ribbonXml + "<mso:dropDown id = ""AddModule"" imageMso = ""ModuleInsert"" getItemLabel = ""SetLabel"" onAction = ""DoSomething"" > "
and the callback routines are:
Sub DoSomething(control As IRibbonControl, SelectedID As String, SelectedIndex As Integer)
MsgBox (control.id) 'just to see if I can retrieve anything
ChosenItemID = SelectedID 'hoping this will contain the selected id
End Sub
and (do I really need this?)
Sub SetLabel(control As IRibbonControl, index As Integer, ByRef returnedval)
returnedval = ChosenItemID 'because this is what some post I read said to do
End Sub
ChosenItem is set up as a global variable in the module.
With thanks