Re: Shortcut menus and VBA

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.


"Scott McDaniel" wrote:

> 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 ...
>
> "FBxiii" <FBxiii@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:4D7AAF4C-5232-45AA-8AB5-10F9F714B19E@xxxxxxxxxxxxxxxx
> > 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.
> >
> >
>
>
>
.



Relevant Pages

  • Re: Events of DataGrid child controls
    ... Thanks for posting. ... But if you want to referenct it, we need to get the sub ... controls' control reference first. ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)
  • Re: Controling visibilty with variable name
    ... Sub HideIt ... routine I can't pass in the the name of the form (Form1). ... another valid reference to Form1. ... The Controls collection, OTOH, is referenced via a Controls property ...
    (microsoft.public.vb.general.discussion)
  • Re: Unload Form and set Nothing
    ... > and Module with Sub Main: ... > Set frm = New Form1 ... In this case reference held by txt doesn't keep the Form from terminating. ... controls in its collection and after that they will keep the form indirectly ...
    (microsoft.public.vb.general.discussion)
  • Re: public variables
    ... The page I'm working on has various controls - butttons, ... manipulate in that particular event. ... I have to repeat this dim in each control event in order to manipulate ... and simply reference them from within a given event like: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Referring to a control on another page
    ... There are to many to pass by reference. ... controls), then perhaps it should be part of that page. ... Friend WithEvents TextBox1 As System.Web.UI.WebControls.TextBox ... Public Sub EnableControls ...
    (microsoft.public.dotnet.framework.aspnet)