Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How can I assign a particular Sub to a button that I create
programmatically? In other words, I have created a subroutine that will create a custom toolbar and buttons on the user's computer. It will created (if it does not exist) or be made visible when a particular workbook is opened and hidden when the workbook closes. How do I assign other subroutines to those custom buttons through the programming? None of the buttons will be for existing Excel functions. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
the easiest thing would be: - delete the old button (enclosed in 'on error resume next / on error goto 0' statements to prevent error if it does not exist) - rebuild the menu and add your new function/sub to it -- Regards Frank Kabel Frankfurt, Germany "Aggie94" schrieb im Newsbeitrag ... How can I assign a particular Sub to a button that I create programmatically? In other words, I have created a subroutine that will create a custom toolbar and buttons on the user's computer. It will created (if it does not exist) or be made visible when a particular workbook is opened and hidden when the workbook closes. How do I assign other subroutines to those custom buttons through the programming? None of the buttons will be for existing Excel functions. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
.OnAction = "MyMacro"
use the onaction property of the button. http://msdn.microsoft.com/library/techart/ofcmdbar.htm -- Regards, Tom Ogilvy "Aggie94" wrote in message ... How can I assign a particular Sub to a button that I create programmatically? In other words, I have created a subroutine that will create a custom toolbar and buttons on the user's computer. It will created (if it does not exist) or be made visible when a particular workbook is opened and hidden when the workbook closes. How do I assign other subroutines to those custom buttons through the programming? None of the buttons will be for existing Excel functions. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I tried the OnAction property but it runs the associated sub at the time the
toolbar is built. After that it does nothing. I am printing out the topic you provided but I have not had a chance to look through it. I'm sure the answer is there but I may be back. Thanks for the help. "Tom Ogilvy" wrote in message ... .OnAction = "MyMacro" use the onaction property of the button. http://msdn.microsoft.com/library/techart/ofcmdbar.htm -- Regards, Tom Ogilvy "Aggie94" wrote in message ... How can I assign a particular Sub to a button that I create programmatically? In other words, I have created a subroutine that will create a custom toolbar and buttons on the user's computer. It will created (if it does not exist) or be made visible when a particular workbook is opened and hidden when the workbook closes. How do I assign other subroutines to those custom buttons through the programming? None of the buttons will be for existing Excel functions. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You asked:
How do I assign other subroutines to those custom buttons through the programming? In that vein, I would create the toolbar each time the workbook was opened or if it is in an addin, each time excel was opened and the addin loaded. Then you should know it is always pointing to the correct file to run the macro. -- Regards, Tom Ogilvy "Aggie94" wrote in message ... I tried the OnAction property but it runs the associated sub at the time the toolbar is built. After that it does nothing. I am printing out the topic you provided but I have not had a chance to look through it. I'm sure the answer is there but I may be back. Thanks for the help. "Tom Ogilvy" wrote in message ... .OnAction = "MyMacro" use the onaction property of the button. http://msdn.microsoft.com/library/techart/ofcmdbar.htm -- Regards, Tom Ogilvy "Aggie94" wrote in message ... How can I assign a particular Sub to a button that I create programmatically? In other words, I have created a subroutine that will create a custom toolbar and buttons on the user's computer. It will created (if it does not exist) or be made visible when a particular workbook is opened and hidden when the workbook closes. How do I assign other subroutines to those custom buttons through the programming? None of the buttons will be for existing Excel functions. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2003 - assign macro to custom toolbar button | Excel Discussion (Misc queries) | |||
Assign Add-In to Custom Toolbar Button Microsoft Office 2007 | Excel Discussion (Misc queries) | |||
2003 - 2007 custom macro and custom button restore. | Excel Discussion (Misc queries) | |||
How Do I Assign a Toolbar Button to a Custom Number Format I creat | Excel Discussion (Misc queries) | |||
How can I assign a symbol to a button (like the $ button) | Excel Discussion (Misc queries) |