Combobox in Custom Ribbon (1 Viewer)

Drand

Registered User.
Local time
Today, 21:09
Joined
Jun 8, 2019
Messages
179
Hi

I have a custom ribbon on which I am trying to place a combobox to enable selection of various reports.

To date I have managed to create the appropriate combobox using the following code:
<tab id="Reports" label="Reports">
<group id="Group23" label="Reports">
<comboBox id="MyCombo"
label="Report Type"
sizeString="AAAAAAAAAAAAAAAAAA"
onChange="ComboBox_OnChange">
<item id="Sales" label="Sales" />
<item id="Separator" label="__________________" />
<item id="Financial" label="Financial" />
<item id="Test" label="Test" />
</comboBox>
</group>
</tab>

I am unable to find how to "trigger an event" when an item in the combobox is selected, like say in the onAction commasnd for a button on the ribbon.

I would like to open a different report based on the item selected in the combobox.

Would really appreciate some assistance with this.

Many thanks

David
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:09
Joined
May 7, 2009
Messages
19,175
test this simple ribbon.
 

Attachments

  • comboOnRibbon.zip
    32 KB · Views: 469

Drand

Registered User.
Local time
Today, 21:09
Joined
Jun 8, 2019
Messages
179
Thanks for this. I will have a look when I get a chance tomorrow. Appreciate your help.
 

Drand

Registered User.
Local time
Today, 21:09
Joined
Jun 8, 2019
Messages
179
Hi again

I have made some progress with this but a couple of issues.

I have modified your code in uSysRibbons to include all the other items I currently have on my custom ribbon and to delete those that show in your example which I don't need. All good and works perfectly in your sample db.

I then exported uSysRibbons and MRibboncallback to my db and ran into a few issues.

What is the significance of "Public gobjRibbon As IRibbonUI" ? When I compile my db I get an error "User-Defined error. User Type not Defined".

Would appreciate your feedback and sorry to keep troubling you.

Many thanks

David
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:09
Joined
May 7, 2009
Messages
19,175
on VBA , Tools->Reference

add reference to Microsoft Office X.XX Object Library. (X.XX means the version of office you have).

''''
Public gobjRibbon As IRibbonUI
means that your Ribbon is now in Public variable.
you can Refresh it (gobjRibbon.Invalidate).
 

Drand

Registered User.
Local time
Today, 21:09
Joined
Jun 8, 2019
Messages
179
Hi again

Sorry for the slow response. I only just the chance to get back to this! All is working perfectly now and this has proved to be really useful in my application.

When you say that "you can Refresh it (gobjRibbon.Invalidate)." does this reset the comobox to it's original state and if so, how do I run this and when?

Once again, many thanks, I really appreciate the help you give me.

David
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:09
Joined
May 7, 2009
Messages
19,175
if you are using a Variable, say Enable/disabling the control on ribbon,
you all .Invalidate to Refresh the ribbon and set Enable/disable a control.

you can further google about Ribbon.
 

Users who are viewing this thread

Top Bottom