|
-
Nov 22nd, 2005, 07:55 PM
#1
Thread Starter
New Member
Creating a toolbar button through code?
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.
-
Nov 22nd, 2005, 10:18 PM
#2
Thread Starter
New Member
Re: Creating a toolbar button through code?
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.
-
Nov 23rd, 2005, 01:01 AM
#3
Re: Creating a toolbar button through code?
If you want to run a commandbar button, either menu or toolbar, just run the .Execute method of the commandbarbutton object instance.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|