VB Code to Add Custom Menu instead of Macros?

  • Thread starter Thread starter Dave Elliott
  • Start date Start date
I haven't done this but from the ObjectBrowser, I think you should be able
to use the Commandbars Collection (with the Add Method) to do this.

Check Access VB Help on the Commanbars object, its Propertie & Methods.
 
I think you mean can the menu bars you make call Vb code?

You can certainly use VB code to "make" a form, but that is very difficult,
and usually we just use the forms designer, and drop things etc. on the
form, and often some of those buttons and things we put on the form can all
VB code. However, writing VB code to "make" a form can be done..it is a LOT
of work, and offers little benefit.

The same idea and concept applies to making menus. You can use drag and drop
and the GUI to make menus. And, those menus can call VB code.

To have a menu bar call your code, you simply just place the name of a
public function (one that you write, and place in a standard module, or in
the forms model (the forms module is a better place if the particular menu
bar is for the current form)) in the menus "on-action" setting

=MyDelete()

So, just place the above in the menus "on-action" setting while in menu
design mode. The above =MyDelete() would thus call a public function called
MyDelete

You can even pass parameters from those menus to the functions if you wish:
 
Back
Top