ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   adding command button to menu (https://www.excelbanter.com/excel-programming/386216-re-adding-command-button-menu.html)

urkec

adding command button to menu
 
Sub AddMacro()

Set bar = CommandBars("Standard")
Set ctl = bar.Controls _
.Add(Type:=msoControlButton)

ctl.Caption = "Run my macro"
ctl.Style = msoButtonCaption

'Macro to run
ctl.OnAction = "MyMacro"

End Sub

--
urkec


"excel-tr" wrote:

Hi,

how can I add a command button to standart excel toolbar.When I click it a
macro will work.

regards.
--
SAHRAYICEDIT-ISTANBUL



All times are GMT +1. The time now is 10:38 PM.

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