programing AllForms button onto toolbar

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Glenn Davy

    programing AllForms button onto toolbar

    hi cdma'ers
    wondering if you can help:
    I'd like to programatically add a commandbar button (msoControlButt on) to
    a 'menu' (msoControlPopu p) and I'd like it to behave the same was as if
    I'd have manually chosen to: 1. customize the menu bars, created/selected
    my custom toolbar, 2. Dragged on to that toolbar a 'NewMenu' 3. On to that
    new menu, dragged a 'form', from the AllForms section


    AFAICT, this means that my commandbutton has to have a builtin ID of 1837 and a parameter which is the name of the desired form.

    so here is what I imagine the code should resemble:
    Dim z As CommandBarButto n
    Set z = Application.Com mandBars("MyMen u").Controls(1) .controls.Add(m soControlButton , 1837, "Form1")

    When I try this I get this error:
    -2147467259(8000 04005) 'Method "Add" of object commandbarcontr ols failed' -

    any ideas?
    thx
    Glenn
Working...