Skip Bisconer
Active Member
- Joined
- Jun 14, 2002
- Messages
- 263
I have set up a utility tool bar that opens with a particular workbook and goes away when that workbook closes. It has been working great for me for a long time with two buttons running macros correctly. I wanted to add another button to run an additional macro to the tool bar but the new button in the below code replaces the second button instead of adding to the toolbar. It must be in the code I have written but I can't figure what is wrong. I appreciate you looking at my problem.
Private Sub Workbook_Open()
On Error Resume Next
Application.CommandBars("MSN Money Stock Quotes").Visible = True
'Macro recorded 6/28/2004 by Milo E Bisconer
'Create a toolbar and add a button with a particular face ID
'to run a macro.
On Error Resume Next
Dim Tbar As CommandBar
Dim NewBtn
Set Tbar = Application.CommandBars.Add
With Tbar
.Name = "Utilities"
.Top = 60
.Left = 1120
.Visible = True
End With
' Use JWalker FaceID Addin
Set NewBtn = Tbar.Controls.Add _
(Type:=msoControlButton)
With NewBtn
.FaceId = 643
.OnAction = "CopyQuickenLastPriceData" 'Run a macro
.Caption = "Quicken Last Price Update" 'Tool tip
End With
Set NewBtn = Tbar.Controls.Add _
(Type:=msoControlButton)
With NewBtn
.FaceId = 1378
.OnAction = "ChangeGainLossMeasure"
.Caption = "Delete Gain Loss measure for new update"
End With
With NewBtn
.FaceId = 25
.OnAction = "OpenfrmProfile"
.Caption = "View Company Profiles"
End With
End Sub
Private Sub Workbook_Open()
On Error Resume Next
Application.CommandBars("MSN Money Stock Quotes").Visible = True
'Macro recorded 6/28/2004 by Milo E Bisconer
'Create a toolbar and add a button with a particular face ID
'to run a macro.
On Error Resume Next
Dim Tbar As CommandBar
Dim NewBtn
Set Tbar = Application.CommandBars.Add
With Tbar
.Name = "Utilities"
.Top = 60
.Left = 1120
.Visible = True
End With
' Use JWalker FaceID Addin
Set NewBtn = Tbar.Controls.Add _
(Type:=msoControlButton)
With NewBtn
.FaceId = 643
.OnAction = "CopyQuickenLastPriceData" 'Run a macro
.Caption = "Quicken Last Price Update" 'Tool tip
End With
Set NewBtn = Tbar.Controls.Add _
(Type:=msoControlButton)
With NewBtn
.FaceId = 1378
.OnAction = "ChangeGainLossMeasure"
.Caption = "Delete Gain Loss measure for new update"
End With
With NewBtn
.FaceId = 25
.OnAction = "OpenfrmProfile"
.Caption = "View Company Profiles"
End With
End Sub