Shortcut menus and VBA

G

Guest

Hi, this is a repost of an earlier question, but hopefully explained a bit
better!

I have created a shortcut menu for a list box called MPR_Queue_Menu.

The menu has various options on it, including 2 'sub' menus.

I need to know the code to set a reference to the shortcut menu and then the
2 specific sub menus I want to change.

e.g.
Set cmdbar = Commandbars("MPR_Queue_Menu").FindControl(,,"Update Status")

cmdbar.Edit


And then Add or Delete options to the sub menu as necessary.

The available options will be retrieved from a recordset, according on which
'Queue' is visible at the time.

Creating the options on the menu and hiding or showing them appropriately is
not feasable as depending on what is shown in the list box will depend on the
available options.

My question is, how do I edit the controls shown on the sub menu within the
shortcut menu in VB6?

I have tried various ways using my VB6 knowledge and consulted the Knowledge
base, but nothing seems to be clear...

Many thanks in anticipation,
Steve.
 
S

Scott McDaniel

Is this an Access application you're trying to manipulate, or VB?

If it's Access, then I'm assuming you're trying to get to manipulate your
toobar or other menu. To do that, use code like this:

dim cbr As CommandBar
dim cbp As CommandBarPopup

set cbr = CommandBars("MPR_Queue_Menu")
Set cbp = cbr.Controls("YourOtherControl")

Of course if the menu control you're looking for isn't a popup you'd have to
change Object types. Also, you'll have to have a reference set to the Office
Objects library ...
 
G

Guest

It is an Access application.

I am new to manipulating toolbars so please bear with me :)

Once I have set references to "YourotherControl" which is a sub menu called
Update Status, how do I Add or Delete the required controls?

I am guessing I need to loop through each control on the menu, delete it,
then recreate the new one, but cannot seem to work the code out to do so.

Could you please provide an example? (The code provided has taken me a step
closer to my goal :)

Cheers,
Steve.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top