Accelator key that can be used while word as focus isntead of user

A

Alexandre

Hi, we have text documents that contains both useless information and information we want to put in a database. The layout is different for each document. we would like to open the document in word and allow the user the select the text he wants to put in a database, then press a key (ex.: ALT+F4) to enter the selected text.

the problem is that I don't know how to detect when a user presses ALT+X. Usualy, it starts a word menu accelarator. I enabled the accelator field of the control I want to launch but it only fires when the userform has focus. Is it possible to do it when word has focus?

Thanks!
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?QWxleGFuZHJl?=,
Hi, we have text documents that contains both useless information and information we
want to put in a database. The layout is different for each document. we would like to
open the document in word and allow the user the select the text he wants to put in a
database, then press a key (ex.: ALT+F4) to enter the selected text.
the problem is that I don't know how to detect when a user presses ALT+X. Usualy, it
starts a word menu accelarator. I enabled the accelator field of the control I want to
launch but it only fires when the userform has focus. Is it possible to do it when word
has focus?You'd need to assign the shortcut key in the Word interface to a macro. In a module in the
same probject with the userform, add a public procedure that calls the procedure for the
data transfer. Then switch to the word file the project is part of and use
Tools/Customize/Keyboard (button). Select the Category "macros", choose the procedure.
Click in the "new key combination" (or whatever it's called in your version of Word), then
press the key combination you prefer (I suggest it NOT be Alt+F4). click Assign.

Note that you'd probably want to load this project as an Addin template.

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