Initiating a Custom Toolbar
I have code that creates a custom toolbar, adds a button to it and assigns a
macro to that button. How do I initialize the toolbar/button when the spreadsheet is opened. Also, once the toolbar/button has been loaded once it doesn't need to run everytime the spreadsheet is open so I need a way to check for the toolbar in excel, if it's there do nothing, if not I need it to run. I have included my code below. Sub CatalystDumpToolBar() Dim CDToolBar As CommandBar Set CDToolBar = CommandBars.Add(temporary:=True) With CDToolBar .Name = "CDToolBar" .Position = msoBarTop .Visible = True End With End Sub Sub AddCustomControl() Dim CBar As CommandBar Dim CTTally As CommandBarControl Set CBar = CommandBars("CDToolBar") Set CTTally = CBar.Controls.Add(Type:=msoControlButton) With CTTally .FaceId = 1763 .OnAction = "CatalystToTally" End With CBar.Visible = True End Sub |
All times are GMT +1. The time now is 12:02 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com