Sub: How to overwrite shortcut keys function in word

J

jayrm100

Hi,

We are in the process of building VSTO 2005 customizations for MS Word
2003.

One of our requirement is to overwrite short cut keys function in word.

Say for example, when a user presses ctrl+X keys the selected text
should not be cut, that is the default function of ctrl+X should not be
fired. Instead my function (Managed code and not a Macro) should be
executed.

We tried with Application.KeyBindings.Add but got the following error:
Word cannot change the function of the specified key.

Code:

this.Application.KeyBindings.Add(WdKeyCategory.wdKeyCategoryCommand,
"MenuItemNew1_Click", ThisApplication.BuildKeyCode(WdKey.wdKeyControl,
ref objKeyX, ref missing, ref missing), ref missing, ref missing);

Where MenuItemNew1_Click is a userdefined function.

Any pointers in resolving the same will be appreciated.

Thanks.
 

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