Discussion:
How to insert separator into the CommandBar created dynamically
(too old to reply)
Rimantas Varanavicius
2004-09-14 11:07:09 UTC
Permalink
Hello,

I can not find the way how to insert the separator between the two buttons
of custom CommandBar inserted into Office MenuBar. Can anyone help me with
some hint?

I use the following code to insert the button:
using MSOffice = Microsoft.Office.Core;
protected MSOffice.CommandBarButton CreateButton(MSOffice.CommandBarPopup
parent, string caption, string tag)
{
MSOffice.CommandBarControl cbc = null;
// Search for existing button
cbc = parent.CommandBar.FindControl(Type.Missing, Type.Missing, tag,
Type.Missing, Type.Missing);
if (cbc == null)
{ // If not found existing button - create new one cbc =
parent.Controls.Add(MSOffice.MsoControlType.msoControlButton, Type.Missing,
Type.Missing, Type.Missing, true);
cbc.Tag = tag;
cbc.Caption = caption;
cbc.Visible = true;
}
return (MSOffice.CommandBarButton) cbc;
}

I tried to look for some specific control type MsoControlType, but could not
find any.
Thank you.

regards,
Rimantas Varanavicius
Charles Maxson
2004-09-14 15:34:32 UTC
Permalink
Did you try to use the BeginGroup property of the control?
cbc.BeginGroup = true;
--
Charles
www.officezealot.com
Post by Rimantas Varanavicius
Hello,
I can not find the way how to insert the separator between the two buttons
of custom CommandBar inserted into Office MenuBar. Can anyone help me with
some hint?
using MSOffice = Microsoft.Office.Core;
protected MSOffice.CommandBarButton CreateButton(MSOffice.CommandBarPopup
parent, string caption, string tag)
{
MSOffice.CommandBarControl cbc = null;
// Search for existing button
cbc = parent.CommandBar.FindControl(Type.Missing, Type.Missing, tag,
Type.Missing, Type.Missing);
if (cbc == null)
{ // If not found existing button - create new one cbc =
parent.Controls.Add(MSOffice.MsoControlType.msoControlButton,
Type.Missing,
Type.Missing, Type.Missing, true);
cbc.Tag = tag;
cbc.Caption = caption;
cbc.Visible = true;
}
return (MSOffice.CommandBarButton) cbc;
}
I tried to look for some specific control type MsoControlType, but could not
find any.
Thank you.
regards,
Rimantas Varanavicius
Loading...