PDA

View Full Version : Solved: ENTER key macro



ctengelen
08-08-2007, 01:01 PM
Help! :help

My BIG BOSS has given me a task that I don't really know that to do with.
I created a "interview" document for him with macros. On Document_New a form opens and the user fills in Text boxes which upload into the actual form. One of the fields is the "Interviewer" and another the "Subject" that is being interviewed.

On Pressing ALT+I my macro copies and inserts the name of the interviewer from the textform field and on pressing ALT+S the macro copies enters the subject's name. So far, so good.

Now he wants to have the macro changed that whenever he presses the ENTER key, the names appear alternately e.g. first ENTER the name of the Interviewer is there, next time he presses the ENTER key the subject't name is there. Next time the Interviewer and so on. I am at a loss on how to go about this this. Does anyone have any helping words for me??
Thanks in advance
Trudy

fumei
08-09-2007, 04:22 PM
"On Document_New a form opens " - do you mean a userform? If so, why on earth are you doing multiple keyboard macros? Use a commandbutton and have it do whatever it is you want done.

As for the different uses of Enter....it could possibly be done, but it is dumb. I don't even really understand the question. The Enter keeps flipping back and forth between interviewer and subject??

Weird.

This is very unusual use of the Enter key. The only way you could do it is to capture the Enter key and check for some variable. If it is X, do some action. If it is Y do some other action.

mdmackillop
08-10-2007, 11:47 AM
Note that you cannot use the KeyPress event with the Enter key, which makes this trickier.

ctengelen
08-13-2007, 06:30 AM
Hi Gerry,
Well, I know this ENTER stuff is dumb, but I had to try since this request comes from the Chief of Police. He said he had some kind of macro in WordPerfect 5.1 (100 years ago) and all he had to do is press the ENTER key to make this happen. (To tell you the truth, I don't believe such macro even existed)

My template starts with a user form and the user enters the names, place etc. that are needed for an interview. I created a toolbar that opens when the userform is filled in. On this toolbar I have two buttons to give a choice between Interviewer and Subject. For the Chief (only because he does not want to use the mouse) I also created the keyboard choices.

Thank you - I can now go and tell him that what he wants is nearly impossible and he should be happy with what he now has.

Trudy