Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Recognize Key

  Asked By: Fareedah    Date: Mar 07    Category: MS Office    Views: 626
  

I remember that I used to recognize some key pressed by the user using
VisualBasic, the event KeyPress and the ASCII table. I don't remember how to do
that, and I don't know if VBA accept it. I'd be glad if anyone could share this
kind of code with me. I'd like to have the ASCII table too... Thx a lot.

Share: 

 

6 Answers Found

 
Answer #1    Answered By: Tamara Nguyen     Answered On: Mar 07

From the Excel help and typing in ASCII in Excel 2003 you'll find the ASCII
character set at
office.microsoft.com/.../HA011331361033.aspx
33.


Yes VBA has a keypress event  but I believe it only applies to controls that
are placed on a sheet or a userform.

I do not believe it's possible to capture keypress  events for a
worksheet.Here is a _Change event for the worksheet and maybe that's useful
for you.

 
Answer #2    Answered By: Ujala Hashmi     Answered On: Mar 07

Should read...
There is a _Change event  for the worksheet

Rather than...
Here is a _Change event for the worksheet

 
Answer #3    Answered By: Robin Bailey     Answered On: Mar 07

Sorry, I forgot to mention: I need to use KeyPress on a Form... I need to close
the Form when I press ESC and to Activate a Routine when I hit ENTER.
Sorry again...

 
Answer #4    Answered By: Oscar Evans     Answered On: Mar 07

make some property changes

ok button ( in the property window )

default = true

and the Cancel button (in the property window)
cancel = true

that will solve your prob

 
Answer #5    Answered By: Michael Evans     Answered On: Mar 07

What I need to do is to activate a Routine when the user  press Enter (or another
key), not activate the "ok" button routine.

 
Answer #6    Answered By: Woodrow Jones     Answered On: Mar 07

I think you need to read the help in VBA on the KeyDown and KeyUp events.
These catch Enter provided the OK button on the form is not set as default.
Keypress does not.

This will catch every KeyUp. You will then need to test to see if it is the
Enter key. It could make your form run slowly.

 
Didn't find what you were looking for? Find more on Recognize Key Or get search suggestion and latest updates.




Tagged: