ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Programatically creating a toolbar to run macros (https://www.excelbanter.com/excel-programming/355069-programatically-creating-toolbar-run-macros.html)

[email protected][_2_]

Programatically creating a toolbar to run macros
 
Hey all,

I need to come up with a way to programatically create a toolbar that
contains some of my macros that will be used by various computers. Am
i correct in assuming that if i manually create a toolbar that it wont
show up on another computer? Under this assumption, i was trying to
add some code into my autoload section that will automatically create a
toolbar with three menus, about 5 items in each, name each macro (ie.
open, save, exit, load, etc) and then assign each item to its
respective macro.

The way i begun this process was to record a macro of myself doing
this. It worked to an extent and by that i mean it created the
toolbar, but none of the text i entered showed up and none of the
macros were assigned. I was wondering if anyone knew of an easy way to
do this or should i continue trying to figure this out.


Thanks,

Justin


Chip Pearson

Programatically creating a toolbar to run macros
 
If you manually create a tool bar, you can Attach that toolbar to
a workbook. This can be done only manually -- there is no
programmatic way to attach a toolbar. In Excel, go to the View
menu, choose Toolbars, then Customize. In that dialog, click
Attach and select your toolbar in the "Custom toolbars" list and
Copy it over to "Toolbars in workbook".

Then, when you send the workbook, it will contain the toolbar and
be accessible in the sent workbook.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




wrote in message
oups.com...
Hey all,

I need to come up with a way to programatically create a
toolbar that
contains some of my macros that will be used by various
computers. Am
i correct in assuming that if i manually create a toolbar that
it wont
show up on another computer? Under this assumption, i was
trying to
add some code into my autoload section that will automatically
create a
toolbar with three menus, about 5 items in each, name each
macro (ie.
open, save, exit, load, etc) and then assign each item to its
respective macro.

The way i begun this process was to record a macro of myself
doing
this. It worked to an extent and by that i mean it created the
toolbar, but none of the text i entered showed up and none of
the
macros were assigned. I was wondering if anyone knew of an
easy way to
do this or should i continue trying to figure this out.


Thanks,

Justin




[email protected][_2_]

Programatically creating a toolbar to run macros
 
alright sweet...i had done that already i just wasnt sure if that was
gonna work....i will have to wait till monday to check it on another
computer. Thanks!


AESanto

Programatically creating a toolbar to run macros
 
Try this:

For add a menu

Sub menu()
CommandBars("Worksheet menu bar") _
..Controls("Edit").Controls.Add(Type:=msoControlPo pup).Caption = "My menu"
..Controls("Edit")..Controls("My menu").OnAction = "My Macro"
End Sub

This will add a MyMenu menu in Edit menu that runs My macro macro.

" wrote:

alright sweet...i had done that already i just wasnt sure if that was
gonna work....i will have to wait till monday to check it on another
computer. Thanks!




All times are GMT +1. The time now is 08:54 PM.

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