Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I created a custom menu with a vba macro in an xla file (excel 2003) but i have a problem : When the code runs, it looks for the macro "mymacro" defined in ".OnAction="mymacro" not in the xla file itself but in the active xls workbook. I do not understand why Thanks for your help |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this Thomas
..OnAction = ThisWorkbook.Name & "!mymacro" -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "thomas" <nomail wrote in message ... Hello, I created a custom menu with a vba macro in an xla file (excel 2003) but i have a problem : When the code runs, it looks for the macro "mymacro" defined in ".OnAction="mymacro" not in the xla file itself but in the active xls workbook. I do not understand why Thanks for your help |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks a lot. i will try it
But i thought a macro runned always within the same workbook, that's not what should be? "Ron de Bruin" a écrit dans le message de groupe de discussion : ... Try this Thomas ..OnAction = ThisWorkbook.Name & "!mymacro" -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "thomas" <nomail wrote in message ... Hello, I created a custom menu with a vba macro in an xla file (excel 2003) but i have a problem : When the code runs, it looks for the macro "mymacro" defined in ".OnAction="mymacro" not in the xla file itself but in the active xls workbook. I do not understand why Thanks for your help |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Unfortunately i tried it today at the office and it does not work
mymacro is in the xla file and the menu command makes it works if i open an xls workbook containing a copy of mymacro and then the menu command makes that copy work. If i deleted that copy, a message says it does not find 'mymacro' "Ron de Bruin" a écrit dans le message de groupe de discussion : ... Try this Thomas ..OnAction = ThisWorkbook.Name & "!mymacro" -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "thomas" <nomail wrote in message ... Hello, I created a custom menu with a vba macro in an xla file (excel 2003) but i have a problem : When the code runs, it looks for the macro "mymacro" defined in ".OnAction="mymacro" not in the xla file itself but in the active xls workbook. I do not understand why Thanks for your help |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
See Debra Dalgleish's site for code to create an add-in with code to add a
Toolbar. http://www.contextures.on.ca/xlToolbar02.html Note the .OnAction line using Thisworkbook as Ron pointed out. Gord Dibben MS Excel MVP On Tue, 7 Oct 2008 20:07:49 +0200, "thomas" <nomail wrote: Unfortunately i tried it today at the office and it does not work mymacro is in the xla file and the menu command makes it works if i open an xls workbook containing a copy of mymacro and then the menu command makes that copy work. If i deleted that copy, a message says it does not find 'mymacro' "Ron de Bruin" a écrit dans le message de groupe de discussion : ... Try this Thomas .OnAction = ThisWorkbook.Name & "!mymacro" |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, i will try tomorrow at office
The difference i see with Ron's code is the " ' " ..OnAction = "'" & ThisWorkbook.Name & "'!" & MacNames(iCtr) "Gord Dibben" <gorddibbATshawDOTca a écrit dans le message de groupe de discussion : ... See Debra Dalgleish's site for code to create an add-in with code to add a Toolbar. http://www.contextures.on.ca/xlToolbar02.html Note the .OnAction line using Thisworkbook as Ron pointed out. Gord Dibben MS Excel MVP On Tue, 7 Oct 2008 20:07:49 +0200, "thomas" <nomail wrote: Unfortunately i tried it today at the office and it does not work mymacro is in the xla file and the menu command makes it works if i open an xls workbook containing a copy of mymacro and then the menu command makes that copy work. If i deleted that copy, a message says it does not find 'mymacro' "Ron de Bruin" a écrit dans le message de groupe de discussion : ... Try this Thomas .OnAction = ThisWorkbook.Name & "!mymacro" |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I tried
..OnAction = "'" & ThisWorkbook.Name & "'!mymacro" and it's the same : It's mymacro in the active workbook that runs and not the one in the xla file project "Gord Dibben" <gorddibbATshawDOTca a écrit dans le message de groupe de discussion : ... See Debra Dalgleish's site for code to create an add-in with code to add a Toolbar. http://www.contextures.on.ca/xlToolbar02.html Note the .OnAction line using Thisworkbook as Ron pointed out. Gord Dibben MS Excel MVP On Tue, 7 Oct 2008 20:07:49 +0200, "thomas" <nomail wrote: Unfortunately i tried it today at the office and it does not work mymacro is in the xla file and the menu command makes it works if i open an xls workbook containing a copy of mymacro and then the menu command makes that copy work. If i deleted that copy, a message says it does not find 'mymacro' "Ron de Bruin" a écrit dans le message de groupe de discussion : ... Try this Thomas .OnAction = ThisWorkbook.Name & "!mymacro" |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think you have confused Excel by having "mymacro" in two separate
workbooks. Delete the "mymacro" from the workbook then save. Close Excel then reopen with your saved workbook. Where does the toolbar button point to? Gord On Tue, 7 Oct 2008 23:22:47 +0200, "thomas" <nomail wrote: I tried .OnAction = "'" & ThisWorkbook.Name & "'!mymacro" and it's the same : It's mymacro in the active workbook that runs and not the one in the xla file project "Gord Dibben" <gorddibbATshawDOTca a écrit dans le message de groupe de discussion : ... See Debra Dalgleish's site for code to create an add-in with code to add a Toolbar. http://www.contextures.on.ca/xlToolbar02.html Note the .OnAction line using Thisworkbook as Ron pointed out. Gord Dibben MS Excel MVP On Tue, 7 Oct 2008 20:07:49 +0200, "thomas" <nomail wrote: Unfortunately i tried it today at the office and it does not work mymacro is in the xla file and the menu command makes it works if i open an xls workbook containing a copy of mymacro and then the menu command makes that copy work. If i deleted that copy, a message says it does not find 'mymacro' "Ron de Bruin" a écrit dans le message de groupe de discussion : ... Try this Thomas .OnAction = ThisWorkbook.Name & "!mymacro" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Custom Menu with Macro doesn't save. | Excel Discussion (Misc queries) | |||
Assign macro to custom menu | Excel Programming | |||
Add menuitems to custom created menu | Excel Programming | |||
How do I add a macro to a custom menu? | Excel Discussion (Misc queries) | |||
run macro from custom menu | Excel Programming |