Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Tony Jollans
 
Posts: n/a
Default

It is possible to set a KeyBinding to Ctrl+x. All that the message really
means is that it can't (at the moment) bind it to the command you're trying
to use.

The most likely reason is that it can't find - or can't bind to - the
command.

If MenuItemNew1_Click is already bound to an ActiveX CommandButton you can't
bind to it. However, if you KeyBind to it before creating the button the
keybinding will stick - I don't know if that's an option for you. If it's in
a UserForm I'm not sure you can do it at all.

Don't know how any of this works with VSTO, I'm afraid - nor any of the C#
references (why objKeyX instead of wdKeyX for example? - and what is the
diference between This.Application and ThisApplication?)

--
Enjoy,
Tony


wrote in message
ps.com...
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.wdK eyCategoryCommand,
"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.





 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word2000 letterhead merge BAW Mailmerge 3 June 25th 05 01:17 PM
Making Word do something that Wordperfect can do NarniaUK New Users 4 May 1st 05 10:44 PM
How do I get my default new document to always be our company let. QuiltDiva Microsoft Word Help 5 April 1st 05 08:20 AM
WordPerfect keyboard macro>Word equivalent? Anty New Users 2 March 13th 05 06:23 PM
creating forms Fluffypink Microsoft Word Help 4 March 9th 05 04:17 PM


All times are GMT +1. The time now is 08:47 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"