Renaming a macro

J

Joe McGuire

This is a simple question (I apologize) but I could not figure out how
tochange the name of one of my macros. When I tried to do this in Tools,
Macros, Edit the macro disappeared from my list of macros. I was able to
get it back pretty easily, but only with the old name. Then I tried Tools,
Templates & Add-Ins, Organizer, but there was nothing in the macro Projects
Items except NewMacros. NO sign of mine. But there MUST be a way to rename
the macro. How? I have a Keyboard Shortcut to run that macro. Will it
still work if the macro is renamed?
 
J

Jay Freedman

To change the name of a macro, you need to open the macro in the VBA editor.
One way to do that is Tools > Macro > Macros > select the macro name > Edit
(you may have to set the "Macros in" box to the specific template or
document containing your macro). Another way is to open the editor (Alt+F11)
and select the template and module that contain the macro.

When you can see the code, just edit the first line, for example change

Sub MyMacro()

to

Sub MyOtherMacro()

and save the template.

After changing the macro's name, you will have to go to Tools > Customize >
Keyboard and reassign the keyboard shortcut -- it won't automatically follow
to the new name.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top