I'm having a problem where my keyboard shortcuts are erased when copying a macro

N

njmike

I'm on a team of four people who create and revise forms all day long
and I've created a number of macros that make our job much easier.
I've passed these along to everybody, as well as instructions on how to
get them to work. The problem we've had up to this point is that
everyone has the macros in different orders with different names, so if
I made a change, I'd have to help everyone individually on where to
find it and make the change. I'm now trying to smooth out the process,
so that when I tweak an older macro or create a new one, each of the
other three users will be able to just copy all of the code and paste
it over their existing code in Visual Basic.

I thought this would be an easy process. I figured that since none of
the individual macro names were changing, that all of the button
assignments would stay in tact. I was only half right. When I tried a
simple copy/paste of all of my macros on my own computer, the buttons
that were previously placed in the toolbar stayed there - and still
worked perfectly. The keyboard assignments, however, were wiped clean.
I tried it a few times - a little different each time - to make sure I
wasn't missing sometihng. When I make a small change to any of the
code, it still works. When I do a quick copy/paste of an entire macro,
its keyboard shortcut does not work.

Is there any way to copy/paste a macro and not lose its keyboard
shortcut? My team will not want to reassign a bunch of macros every
time I make a change.

Maybe even better yet - is there a way to write a macro that will
assign shortcut keys to other macros? That would be perfect.

Thank you in advance for any help you can offer.

- Mike
 
C

Cindy M -WordMVP-

Have you considered putting all the macro code, toolbars, etc. in a
single TEMPLATE file (*.dot) that you can distribute. NOT the Normal.dot,
but another file.

Then each user (including yourself) can put this template in Word's
STARTUP folder. When Word starts, it will be loaded as an Add-in (you
should see it in Tools/Templates and Addins). The toolbars and macros
will be available, and no one will have to do any further work with it.
I'm on a team of four people who create and revise forms all day long
and I've created a number of macros that make our job much easier.
I've passed these along to everybody, as well as instructions on how to
get them to work. The problem we've had up to this point is that
everyone has the macros in different orders with different names, so if
I made a change, I'd have to help everyone individually on where to
find it and make the change. I'm now trying to smooth out the process,
so that when I tweak an older macro or create a new one, each of the
other three users will be able to just copy all of the code and paste
it over their existing code in Visual Basic.

I thought this would be an easy process. I figured that since none of
the individual macro names were changing, that all of the button
assignments would stay in tact. I was only half right. When I tried a
simple copy/paste of all of my macros on my own computer, the buttons
that were previously placed in the toolbar stayed there - and still
worked perfectly. The keyboard assignments, however, were wiped clean.
I tried it a few times - a little different each time - to make sure I
wasn't missing sometihng. When I make a small change to any of the
code, it still works. When I do a quick copy/paste of an entire macro,
its keyboard shortcut does not work.

Is there any way to copy/paste a macro and not lose its keyboard
shortcut? My team will not want to reassign a bunch of macros every
time I make a change.

Maybe even better yet - is there a way to write a macro that will
assign shortcut keys to other macros? That would be perfect.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
C

Charles Kenyon

The macros need to be copied before the shortcuts, and shortcuts can only be
copied using vba or an Add-In. See
http://addbalance.com/word/movetotemplate.htm for step-by-step instructions
on moving / sharing / copying / backing-up customizations including
AutoText, AutoCorrect, keyboard assignments, toolbars, macros, etc.
--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide




--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
M

Mike

Cindy,

After I posted this, I did some searches on my own and saw that you
could create a new template. It sounds great, but I've had problems
getting it to work.

Charles,

The link you provided looks like it could be very helpful, except that
I get stuck when it's time to "Copy Your Macros." The tutorial says to
copy the Macro Module "New Macros" from Normal.dot to the new template,
but when I try, I get an error message that says "The project item
cannot be copied." Of course, the tutorial doesn't mention this, so
I'm sitting here pulling my hair out at this message. I'm not finding
any results on Google.

I understand the concept of a template and to put it in the startup
folder, but I can't get it to actually do anything.
 
M

Mike

I figured out how to create a macro that will assign keyboard
shortcuts! To me, this is much easier than trying to make a template
(especially since I can't get it to work). For some reason, I didn't
think it was going to work, but I just went ahead and started recording
and went to assign it. Then I went and looked at the code, which was:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 5/11/2006 by Mike
'
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyL, wdKeyAlt),
KeyCategory:= _
wdKeyCategoryMacro, Command:=""
End Sub

The only problem was that part that reads Command:="" , so I just put
the name of the macro I want to assign that shortcut to in between the
quotes. It worked. Now I should be able to do all of them in the same
macro.
 
C

Cindy M -WordMVP-

Hi Mike,
After I posted this, I did some searches on my own and saw that you
could create a new template. It sounds great, but I've had problems
getting it to work.
If you ever decide to come back to this, please describe HOW it
"didn't work". It should be possible.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 

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

Top