Hi =?Utf-8?B?QWxhbkM=?=,
Is there any way to avoid putting code in a template? I'm developing an
add-in that will be widely distributed, and it seems that putting code in
templates could cause problems. I have plenty of C++ experience, so if there
is some way to do this with ugly COM code, I'll be happy to try.
No, I'm afraid it's not possible. Keyboard shortcuts in Word can only be
assigned to things in a "Word context", which for code means code in a Word VBA
project. And Word locks API keyboard calls out.
Closest you could get would be to create the necessary procedures in the
document on the fly. But that will give you even more problems than putting code
in the template, then signing it with a digital signature / certificate. If you
have a signed VBA project, and the person installing it trusts your certificate,
it should install and run with no problem with a "High" macro security setting.
Only people who've set "Very High" (only available in Word 2003) would get
"locked out".
One other possibility, if your Addin is accessible via toolbars IN the template,
would be to assign these buttons accelerator keys (Alt+something) by using
ampersands in the caption (which must be visible). &Xyz would be accessible
using Alt+X, for example. You just have to watch out that you don't use
shortcuts already assigned to Word's menus.
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