View Full Version : add a button to a built in toolbar
lior03
03-21-2006, 06:39 AM
hello
i want to add a button to the srtandard toolbar.
how can i have it the faceid number i want?.
how can i have the caption on the toolbar?
With Application.CommandBars("standard").Controls.add
.Caption = "autofit"
.OnAction = "fifts"
End With
End Sub
thanks
TonyJollans
03-21-2006, 07:17 AM
Like this perhaps ...
With Application.CommandBars("standard").Controls.Add
.Caption = "autofit"
.FaceId = 1234
.Style = msoButtonCaption
.OnAction = "fifts"
End With
lior03
03-21-2006, 09:58 AM
hell
thanks for the code.how do i delete a button from the standard toolbar when i close the workbook?
thanks
mdmackillop
03-21-2006, 11:21 AM
Hi Moshe,
Putting it all together, add the following to the Workbook module
Option Explicit
Private Sub Workbook_Open()
With Application.CommandBars("standard").Controls.Add
.Caption = "autofit"
.FaceId = 1234
.Style = msoButtonCaption
.OnAction = "fifts"
End With
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("standard").Controls("Autofit").Delete
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.