Begin a group in a custom commandbar

D

Dale Fye

I've got the following code in an application, and need to know how to begin
a group (put a dividing line between it and the previous menu item) at the
Gap Synthesis menu item. I know how to do this with commandbars that are
built using the View -> Toolbars -> Customize dialog, but not how to do it in
code.

Set cbr = CommandBars.Add("MyMenu", BarPopup, , True)

With cbr

Set cbrButton = cbr.Controls.Add(ControlButton, , , , True)
With cbrButton
.Caption = "&DoSomething"
.Tag = "DoSomething"
.OnAction = "=fnDoSomething()"
End With

Set cbrButton = cbr.Controls.Add(ControlButton, , , , True)
With cbrButton
.Caption = "&Gap Synthesis"
.Tag = "Gap Synthesis"
.OnAction = "=fnGapSynthesis"
End With

End With

Dale
 
G

Graham Mandeno

Hi Dale

BeginGroup is a boolean property of a CommandBarControl.

Just add:
.BeginGroup = True
to your With block for the "Gap Synthesis" button.
 
D

Dale Fye

Thanks, Graham.

I could swear I tried that, and don't know why intellisense was not
providing me with the options for the cbr object.

Dale

Graham Mandeno said:
Hi Dale

BeginGroup is a boolean property of a CommandBarControl.

Just add:
.BeginGroup = True
to your With block for the "Gap Synthesis" button.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

Dale Fye said:
I've got the following code in an application, and need to know how to
begin
a group (put a dividing line between it and the previous menu item) at
the
Gap Synthesis menu item. I know how to do this with commandbars that are
built using the View -> Toolbars -> Customize dialog, but not how to do
it in
code.

Set cbr = CommandBars.Add("MyMenu", BarPopup, , True)

With cbr

Set cbrButton = cbr.Controls.Add(ControlButton, , , , True)
With cbrButton
.Caption = "&DoSomething"
.Tag = "DoSomething"
.OnAction = "=fnDoSomething()"
End With

Set cbrButton = cbr.Controls.Add(ControlButton, , , , True)
With cbrButton
.Caption = "&Gap Synthesis"
.Tag = "Gap Synthesis"
.OnAction = "=fnGapSynthesis"
End With

End With

Dale
 

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