Hi Sam Wow that worked in getting onto toolbar.
I would like to have several 'run macroxx' on the toolbar. Each one a different macro to run. I would need an input box to give caption for each entry on toolbar and a listbox to select the macro from a list of available macro (from Macro dialog)to attach to that caption. eg caption: Run: Sort which would use macro 'SortAscend' eg caption: Run: Format which would use macro "FormatSheet" Sorry to trouble you and make more complicated. Regards Charlie On Sat, Feb 25, 2012 at 11:24 PM, Sam Mathai Chacko <samde...@gmail.com>wrote: > Yes this can be done.... > > Just a quick scrap here with bare minimum requirements... > > Sub AddMacroToToolBar() > > Dim lngLoop As Long > Const strMacroNames = "Macro,Delete" > > For lngLoop = 1 To 2 > With Application.CommandBars("Worksheet Menu > Bar").Controls("&Tools") > On Error Resume Next > .Controls("Run " & Split(strMacroNames, ",")(lngLoop - > 1)).Delete > Err.Clear: On Error GoTo 0 > With .Controls.Add(Type:=msoControlButton, ID:=1) > .Style = msoButtonIconAndCaption > .Caption = "Run " & Split(strMacroNames, ",")(lngLoop - 1) > .OnAction = Split(strMacroNames, ",")(lngLoop - 1) > End With > End With > Next > > End Sub > > Regards, > > Sam Mathai Chacko > > > On Sat, Feb 25, 2012 at 6:44 AM, Cab Boose <swch...@gmail.com> wrote: > >> Hi >> >> Xl2000 >> >> I want to add some macros to the existing 'Tools' toolbar. Have >> looked at several on the net. JKP, Contextures, Vbax, etc. They seem to >> use mainly a floating toolbar. >> >> I just want to run a macro that says - Add this macro (from a list >> showing in current workbook) onto the 'Tools' toolbar, and maybe a 'Delete' >> from tools toolbar. >> >> Anyone know of a suitable code online. >> >> >> Thanks and regards >> >> Charlie Harris >> >> >> >> >> >> -- >> FORUM RULES (986+ members already BANNED for violation) >> >> 1) Use concise, accurate thread titles. Poor thread titles, like Please >> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice >> will not get quick attention or may not be answered. >> >> 2) Don't post a question in the thread of another member. >> >> 3) Don't post questions regarding breaking or bypassing any security >> measure. >> >> 4) Acknowledge the responses you receive, good or bad. >> >> 5) Cross-promotion of, or links to, forums competitive to this forum in >> signatures are prohibited. >> >> NOTE : Don't ever post personal or confidential data in a workbook. Forum >> owners and members are not responsible for any loss. >> >> >> ------------------------------------------------------------------------------------------------------ >> To post to this group, send email to excel-macros@googlegroups.com >> > > > > -- > Sam Mathai Chacko > > -- > FORUM RULES (986+ members already BANNED for violation) > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > > 2) Don't post a question in the thread of another member. > > 3) Don't post questions regarding breaking or bypassing any security > measure. > > 4) Acknowledge the responses you receive, good or bad. > > 5) Cross-promotion of, or links to, forums competitive to this forum in > signatures are prohibited. > > NOTE : Don't ever post personal or confidential data in a workbook. Forum > owners and members are not responsible for any loss. > > > ------------------------------------------------------------------------------------------------------ > To post to this group, send email to excel-macros@googlegroups.com > -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com