ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Commandbar button running macro (https://www.excelbanter.com/excel-programming/272766-commandbar-button-running-macro.html)

Kwan Kim Chuen

Commandbar button running macro
 
I have these code in the VBA. This code works and create
the controls on my command bar to run the respective
macros. However, the name of the assigned macros were
preceeded with the spreasheet's name, except for the last
created control. How do I make the other controls behave
like the last one.

Set buttonSix = MyBar.Controls.Add
(Type:=msoControlButton)
With buttonSix
'.FaceId = 133
.Caption = "Print Costing Section"
.Style = msoButtonCaption
.BeginGroup = True
.OnAction = "Printcosting"
End With
Set buttonOne = MyBar.Controls.Add
(Type:=msoControlButton)
With buttonOne
'.FaceId = 133
.Caption = "Show/Hide Unit/Total Price"
.Style = msoButtonCaption
.Tag = "EasyEntry"
.BeginGroup = True
.OnAction = "EasyEntry"
End With
Set buttonTwo = MyBar.Controls.Add
(Type:=msoControlButton)
With buttonTwo
'.FaceId = 133
.Caption = "Checking"
.Style = msoButtonCaption
.BeginGroup = True
.OnAction = "!SanityCheck"
End With



All times are GMT +1. The time now is 04:13 PM.

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