By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,968 Members | 1,410 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,968 IT Pros & Developers. It's quick & easy.

programing AllForms button onto toolbar

P: n/a
hi cdma'ers
wondering if you can help:
I'd like to programatically add a commandbar button (msoControlButton) to
a 'menu' (msoControlPopup) 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 CommandBarButton
Set z = Application.CommandBars("MyMenu").Controls(1).cont rols.Add(msoControlButton, 1837, "Form1")

When I try this I get this error:
-2147467259(800004005) 'Method "Add" of object commandbarcontrols failed' -

any ideas?
Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.