View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Kwan Kim Chuen Kwan Kim Chuen is offline
external usenet poster
 
Posts: 1
Default 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