Reputation: 102
I know how to create functions within a VBA project to create new code/modules/forms using the VBIDE library, but is it possible to tie these functions to a button in the VBA editor, so that I may insert code snippets say at the cursor position?
Upvotes: 2
Views: 185
Reputation: 9461
The VBIDE object model gives you access to the CommandBars object model of the VBIDE, so you can edit existing CommandBars, and add your own.
The CommandBars of the VBIDE differ in one important way to those of other Office applications in that the OnAction properties must be used in conjunction with event handlers that you'll need to write.
Chip Pearson has a good write-up and lots of examples at http://www.cpearson.com/excel/vbemenus.aspx
Adding menu items the VBA Editor (VBE) menus is somewhat different than adding menus to the main Excel menus. A workbook or add-in that creates and responds to menu items in the VBE needs at least two modules: a code module to contain the code to create the menu items and the procedures to be called by the menu items, and a class module to respond the the Click events of the menu items.
Upvotes: 1