I have a code to list time entry (In Time, Out Time, Comments, Employee Name) information for all the employees from SQL in Excel 2010 using Excel Add-In project. Here, I wanted to move step ahead to list time entry information for selected employee from the ComboBox control (which holds the employee name and employee id in label and tag properties respectively) place in Excel Ribbon using Excel Add-In.
Here, I was unable to get the selected employee's tag (Id) from ComboBox that I have added.
Please any one help me to resolve this.
Thanks
Well this is a bit tricky but doable. First you can do that only via Ribbon XML (not via designer - at least I don't know about it)
I created very simple XML
The key part is the GetItemCount (you can name it as you want) Without this callback you will never get any callback for the getItemID or getItemLabel.
The rest is then easy, create an object that stores all the information you need, like here
initiate the object with values like below (for easier following I put all inside the Ribbon class but this is definitely bad approach)
and then the callbacks (still inside the Ribbon1 class) (For list of callbacks refers here)
Then you should see the DropDown list in your Office application, under the Add-ins tab with the tree values in this example and when you select one you should get name and ID of the employee.