Back in the old days of VBA, we used to be able to directly access controls on a form by name. I'm a little perplexed by how to do this in VBA 2010 (or if it's even possible any longer).
Say I have a ribbon control with a dropdown list called "channelList", and elsewhere on the ribbon I have a textbox called "labelText". Each of these items has a unique callback function - when I type something into labelText, its callback fires, and when I select an item from the channelList listbox, its callback fires with the list item passed as an argument.
Where I'm stumped by is how I would update the labelText textbox contents with 'something' from within the channelList callback.
Is there a way to directly access the textbox control from within the listbox callback, or must I generate some sort of event? What method or function would I use to set the text value for the control? (Do I need to cast the IRibbonControl object to something?)
The solution was a combination of an answer and the comments, so here goes:
editBox id="labelText" label="Text:" sizeString="xxxxxxxxxx" onChange="TextboxCallback" getText="UpdateTextBoxText" screentip="Channel label" supertip="Limited to 10 characters. Press Enter once finished typing."
MyRibbon.InvalidateControl "labelText"
Sub UpdateTextBoxText(control As IRibbonControl, ByRef returnedVal) Select Case (control.id) Case "labelText" returnedVal = LabelText End Select End Sub
I guess this is "progress". labelText.Value = "blah" is far too simple.