-
Update combobox in Add-in menu with new value
Hopefully this is a straightforward thing...
I have a combobox in my ppt Add-in that I would like to update with the "Category" document property of the presentation when a new presentation is opened. I'm struggling to get the references to the combobox right (at least I think that is where I am stuck. I have the following code that doesn't do anything:
Sub Auto_Open()
Dim octrl As CommandBarComboBox
Set octrl = CommandBars("CustomTab").FindControl(msoControlComboBox, "Combo1")
octrl.text = "Classified"
End Sub
"CustomTab" is the ID of my add-in and "Combo1" is the ID of my combobox. I have tried also with the labels etc. but have not been able to make it work. Any ideas would be greatly appreciated!
Regards,
-
Actually I managed to figure it out. The trick was to update the xml for the ribbon to callback reference for a separate macro that provides the initialization value of the combobox. So my xml line for the box in question now looks like:
<comboBox id="Combo1" label="Category" tag="Combo1" onChange="UpdateCategory" getText="MyTextMacro" >
It is the getText part that brings back the initial value.
Just in case anyone comes across the thread and is looking for the solution.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules