ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding a Dropdown Control to a Command Bar (https://www.excelbanter.com/excel-programming/423589-adding-dropdown-control-command-bar.html)

Tom Joseph

Adding a Dropdown Control to a Command Bar
 
I would like to replace one of the command buttons in the sub below with a
dropdown control. I would like the dropdown control to have several list
items, each of which should have an onAction property.

Here is what I am starting with.

Any help and some example code woud be much appreciated.

Thanks,


Sub OpenCommandBar()

Dim cb As CommandBar
Dim cbb As CommandBarButton

Set cb = Application.CommandBars.Add("Dashboard Controls", _
msoBarFloating, False, True)
cb.Enabled = True
cb.Visible = True

Set cbb = cb.Controls.Add(msoControlButton)
cbb.Style = msoButtonIconAndCaption
cbb.Caption = "Refresh Data"
cbb.FaceId = 159
cbb.OnAction = "InitializeDataInput2"

Set cbb = cb.Controls.Add(msoControlButton)
cbb.Style = msoButtonIconAndCaption
cbb.Caption = "Generate Reports"
cbb.FaceId = 433
cbb.OnAction = "ProcessReportSet01"

Set cbb = cb.Controls.Add(msoControlButton)
cbb.Style = msoButtonIconAndCaption
cbb.Caption = "Print Reports"
cbb.FaceId = 4
cbb.OnAction = "PrintSet01"

Set cbb = cb.Controls.Add(msoControlButton)
cbb.Style = msoButtonIconAndCaption
cbb.Caption = "eMail Reports"
cbb.FaceId = 258
cbb.OnAction = "CreateAndEmailReports"

End Sub

JLGWhiz

Adding a Dropdown Control to a Command Bar
 
It is not necessary to triple post. Someone will assist when they get time,
if they think they can help.

"Tom Joseph" wrote:

I would like to replace one of the command buttons in the sub below with a
dropdown control. I would like the dropdown control to have several list
items, each of which should have an onAction property.

Here is what I am starting with.

Any help and some example code woud be much appreciated.

Thanks,


Sub OpenCommandBar()

Dim cb As CommandBar
Dim cbb As CommandBarButton

Set cb = Application.CommandBars.Add("Dashboard Controls", _
msoBarFloating, False, True)
cb.Enabled = True
cb.Visible = True

Set cbb = cb.Controls.Add(msoControlButton)
cbb.Style = msoButtonIconAndCaption
cbb.Caption = "Refresh Data"
cbb.FaceId = 159
cbb.OnAction = "InitializeDataInput2"

Set cbb = cb.Controls.Add(msoControlButton)
cbb.Style = msoButtonIconAndCaption
cbb.Caption = "Generate Reports"
cbb.FaceId = 433
cbb.OnAction = "ProcessReportSet01"

Set cbb = cb.Controls.Add(msoControlButton)
cbb.Style = msoButtonIconAndCaption
cbb.Caption = "Print Reports"
cbb.FaceId = 4
cbb.OnAction = "PrintSet01"

Set cbb = cb.Controls.Add(msoControlButton)
cbb.Style = msoButtonIconAndCaption
cbb.Caption = "eMail Reports"
cbb.FaceId = 258
cbb.OnAction = "CreateAndEmailReports"

End Sub


Tom Joseph

Adding a Dropdown Control to a Command Bar
 
My aplopgies for that. I got an error each time telling me the qestion was
not transmitted so I reposted. I assumed that was a correct message.

"JLGWhiz" wrote:

It is not necessary to triple post. Someone will assist when they get time,
if they think they can help.

"Tom Joseph" wrote:

I would like to replace one of the command buttons in the sub below with a
dropdown control. I would like the dropdown control to have several list
items, each of which should have an onAction property.

Here is what I am starting with.

Any help and some example code woud be much appreciated.

Thanks,


Sub OpenCommandBar()

Dim cb As CommandBar
Dim cbb As CommandBarButton

Set cb = Application.CommandBars.Add("Dashboard Controls", _
msoBarFloating, False, True)
cb.Enabled = True
cb.Visible = True

Set cbb = cb.Controls.Add(msoControlButton)
cbb.Style = msoButtonIconAndCaption
cbb.Caption = "Refresh Data"
cbb.FaceId = 159
cbb.OnAction = "InitializeDataInput2"

Set cbb = cb.Controls.Add(msoControlButton)
cbb.Style = msoButtonIconAndCaption
cbb.Caption = "Generate Reports"
cbb.FaceId = 433
cbb.OnAction = "ProcessReportSet01"

Set cbb = cb.Controls.Add(msoControlButton)
cbb.Style = msoButtonIconAndCaption
cbb.Caption = "Print Reports"
cbb.FaceId = 4
cbb.OnAction = "PrintSet01"

Set cbb = cb.Controls.Add(msoControlButton)
cbb.Style = msoButtonIconAndCaption
cbb.Caption = "eMail Reports"
cbb.FaceId = 258
cbb.OnAction = "CreateAndEmailReports"

End Sub


Jim Cone[_2_]

Adding a Dropdown Control to a Command Bar
 
See your third post.


All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com