In an ArcMap Map Document that was created from a template, clicking on a macro control produces the following error."Macro not found: Project.ThisDocument.MacroName"
The Template was created from a Map Document. When you convert a Map Document to a Template, the code for macros moves from the Project module to the TemplateProject module. But the macro control still references the Project module.
This is a known issue.
Solution or Workaround
Choose the solution below which best fits your needs. If you regularly create new Map Documents from the template be sure to complete the second bullet point. Otherwise, simply repair your Map Document as described in bullet one. You may wish to complete both solutions.
- Repair the Map Document. Copy the macro code from the TemplateProject module to the Project module.
a. Select Tools > Macros > Visual Basic Editor.
b. Double click on TemplateProject > ArcMap Objects > ThisDocument.
c. Find the sub routine with the same name as the macro that is not working and select all the code.
d. Select Edit > Copy.
e. Double click on Project > ArcMap Objects > ThisDocument.
f. Place the cursor at the top of the code module and select Edit > Paste.
g. Close the V Basic Editor.
- Repair the Template. Delete then readd the macro control.
a. Select Tools > Customize.
b. Select the bad macro control and drag it off the control bar.
c. Switch to the Commands tab on the Customize dialog.
d. Select Macros from the Categories list.
e. Drag the macro from the Commands list to the control bar.
f. Close the Customize dialog.
e. Save the template.
Map Documents created from this template should now work.