PDA

Click to See Complete Forum and Search --> : Creating a toolbar button through code?


davidd31415
Nov 22nd, 2005, 06:55 PM
I've tried using the macro recorder to get some hints on this one, but it doesn't seem to pick anything up...

I'd like to create a button on a (custom) toolbar and set it to run a certain macro when a workbook is opened. I've got the code for creating the toolbar in place...

My goal is to have a toolbar that allows the user to select between worksheets since the tabs at the bottom need to be scrolled and right clicking on the scroll buttons only brings up a partial list until the user clicks on the entry to bring up the entire list.

I see some other directions I'd like to go from here (having subfields, much like you can organize your bookmarks and start menus) but first off I'd like to have a solution where the controls do not move off the screen when the page is scrolled.

I've looked at using freeze panes but that method just looks messy compared to putting a toolbar up...

Thanks all,

David.

davidd31415
Nov 22nd, 2005, 09:18 PM
Looking at the Application.CommandBars("TheCommandBarICreated") object in the debugger a little more closely, I'm thinking I may find my solution with the .Controls.Item1.OnAction property.

RobDog888
Nov 23rd, 2005, 12:01 AM
If you want to run a commandbar button, either menu or toolbar, just run the .Execute method of the commandbarbutton object instance.