Getting the selected item from the dropdown in a ribbon in Word 2007 using macro?

I wanted to put the solution just in case someone has the same problem.

I wanted to put the solution just in case someone has the same problem:- This is how my ribbon dropdown looks like :- Note the callbacks for getItemLabel and onAction. Interestingly, getItemLabel is meant for setting the item on the dropdown (get by the dropdown). It is kinda confusing but thats the way it is and thats why I named my method as "SetTheSelectedItemInDropDown".

Function "GetTheSelectedItemInDropDown" for the onAction is to get the selected item. Now following is the macro code:- ' Declare a global variable to hold the selected item Dim itemName As String ' Definition of GetTheSelectedItemInDropDown which gets the selected item of the dropdown Sub GetTheSelectedItemInDropDown(control As IRibbonControl , id As String, index As Integer) If control. Id = "ddlItems" Then itemName= id End If End Sub 'Definition for SetTheSelectedItemInDropDown which sets the value in the dropdown from the global variable Sub SetTheSelectedItemInDropDown(control As IRibbonControl, index As Integer, ByRef returnedVal) If control.Id = "ddlItems" Then returnedVal = itemName End If End Sub And thats it, you should be able to set and get the dropdown now.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions