Is it possible to add a new button(with a nice pic) to any of the existing tool bars? I am planning to add a button to associate a macro with it. And, I don’t want to use the “Visual Basic Tool Bar”.
BO provides a CmdBars class for this purpose. You can create a new toolbar or add buttons to existing toolbars with this.
There is an example here where the add-in adds a pop-up menu to the main toolbar. You can use a similar method to create new toolbars and add faces to them. Distributing this as an add-in is usually the most efficient way for ppl to use the functionality.
Check out the other post, it might give you some ideas on this.
I prefer to create a separate toolbar and/or main menu item for this purpose. May seem a little silly for only one button, but inevitably you will probably want to (or be asked to) add additional buttons. Creating your own toolbar / menu item keeps the “custom” functionality separate from the “built-in” functionality.
The answer to your question though is yes, you can add buttons to existing toolbars. One approach can be found in this utility. I have other examples (including getting a custom bmp icon from a userform rather than having to distribute the bmp file), but this should give you a good start.
Thanks for the response. I got some good idea after seeing your code . Everything works fine… But, why the tool bar button(BMP file) is not showing up? I am using the following line of code
Application.Clipboard.SetData LoadPicture(ThisDocument.Path & "C:\Program Files\Business Objects\BusinessObjects 5.0\UserDocs\Report.bmp")
ReportButton.PasteFace
Thanks Dwayne… I have your utility but I was hesitating in using your code for my purpose…
Also, Is it OK to ask you for the code to get a custom bmp icon from a user form? I am sure this is going to be very useful compared to distributing the bmp file.
I noticed that in the two examples which were given the extra menu was attached to Application.CmdBars(2).
Is there another one which will accept Menus? I don’t really want to use Application.CmdBars(2) becasue I want to see only my menus…
thanks for you help.