Custom Word toolbar buttons not working ONLY when docked

R

Rob Stewart

I have a custom Word toolbar with 20 odd buttons on it.

The toolbar is created, and the buttons execute code, in c#. All the buttons
work fine when the toolbar is floating, however when it is docked, only the
visible buttons work.

The buttons that are hidden behind the drop down type arrow to the right of
the toolbar (due to there being too many buttons to display across the
screen) have no effect when clicked. If I then undock the toolbar and click
the same button, it works.

Has anyone come across this? Any solutions?

Cheers,
Rob
 
P

Peter Huang

Hi

I think you may try to set the Tag property of the CommandBarButton to see
if that works.
e.g.
Excel.Application oExcel;
Object oMissing = System.Reflection.Missing.Value;

// Start Excel.
oExcel = new Excel.Application();
// Show Excel and set UserControl
oExcel.Visible = true;
oCommandBar =
oExcel.CommandBars.Add("Custom17",oMissing,oMissing,oMissing);
customBar =
(Office.CommandBarButton)oCommandBar.Controls.Add(Office.MsoControlType.msoC
ontrolButton,oMissing,oMissing,oMissing,oMissing);
customBar.Caption = "4234";
customBar.Tag = "1234";////This line is necessary.
customBar.Click+=new
Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(customBar_Cl
ick);

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
R

Rob Stewart

Excellent, that fixed it Peter...thanks.

FYI to others ... see KB article #826931
 
P

Peter Huang

Hi

I am glad that works for you.
Cheers!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top