BusinessObjects Board

New Button to any existing Tool Bar?

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”.

Any thoughts on this?


Ravi Amara :us: (BOB member since 2002-10-02)

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.


avaksi :us: (BOB member since 2002-08-22)

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.


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

Hi avaksi,

Thanks for the response. I got some good idea after seeing your code :slight_smile: . Everything works fine… But, why the tool bar button(BMP file) is not showing up? I am using the following line of code :cry:


Application.Clipboard.SetData LoadPicture(ThisDocument.Path & "C:\Program Files\Business Objects\BusinessObjects 5.0\UserDocs\Report.bmp")
ReportButton.PasteFace

Am I missing something here?


Ravi Amara :us: (BOB member since 2002-10-02)

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.

Thanks for your help.
Ravi


Ravi Amara :us: (BOB member since 2002-10-02)

Instead of:

Application.Clipboard.SetData LoadPicture(ThisDocument.Path & "\CopyDP.bmp")
Button.PasteFace

put the same bitmap into an image control on the userform and use:

Application.Clipboard.SetData CopyDataProviderForm.Image1.Picture
Button.PasteFace

Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

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.


Olivier Masse :fr: (BOB member since 2002-08-29)