#1
|
|||
|
|||
Calling a macro from a template using OnAction
I have created a template called "Sandra Macros.dotm"
I have created a custom menu to call a procedure in this template Set myCmdBarCtl = myCommandBar.Controls.Add(msoControlButton) with myCmdBarCtl .BeginGroup = True .OnAction = "=SaveAllImages()" End with I attach the template to the current document If I move the procedure SaveAllImages() to Normal.dotm the button works. If not I receive an error " The macro cannot be found or has been disabled because of macro security setting" - The macro security is low ... it works when in Normal.dotm. How should I indicate to "OnAction" to search in the template? tried adding the template name .. did not work |
#2
|
||||
|
||||
That's because the command button is still looking for its macro in the original template; you'd need to recreate the command button in the Normal template.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
The problem is that the macro is a tool that people need to use on different documents. When they want to use the macro they will attach the macro to their document and use it. This template will not be attached automatically. It should be used on demand
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro added to Ribbon in template does not appear after attaching template | rocky2 | Word VBA | 1 | 04-04-2016 12:00 AM |
#REF Error when calling VBA Function | RodneyJ | Excel Programming | 1 | 01-21-2016 12:42 PM |
Calling a macro in powerpoint from command line | SeattleITguy | PowerPoint | 4 | 11-26-2014 01:41 AM |
.OnAction only works in document with the code | donbexcel | Word VBA | 1 | 11-02-2011 05:25 AM |
Re-Calling Sent Email | freschij | Outlook | 1 | 12-06-2010 09:16 PM |