Adding Controls to Toolbars and Menus

One of the most common means of allowing users to run code in an application is to add buttons to a toolbar or menu that respond when clicked. In VBA, you can use the Customize menu to associate macro code with a toolbar button; you simply drag the macro to the toolbar. As you learned in Chapters 6 and 7, using VSTO you must programmati-cally create menus and toolbars and write code in the Click event handlers of the buttons you add. First we look at how you can add a button to an existing toolbar (the Standard toolbar), and then we describe how you can add a custom icon to the button.

0 0

Post a comment