Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Customising a Ribbon in Microsoft Project 2010 using VBA

Status
Not open for further replies.

popper

Programmer
Dec 19, 2002
103
AU
(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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top