PDA

View Full Version : Assignment A New Mission To ALT Key



Erdin? E. Ka
09-25-2006, 08:36 PM
Hi everyone!:hi:

I try to change ALT Key's function to "%" by the codes below, but i should missed something or there is something wrong that i can't understand. :dunno

While i closing the workbook i am getting a MsgBox as;
Run-time error-'1004':
Method 'OnKey' of object '_Application' failed
And i click to Debug then YellowLine on; Auto_Close's : Application.OnKey "{ALT}" Row.


Code To Module1;

Sub Auto_Open()
Application.OnKey "{ALT}", "Change_ActiveCell_Value_As_Percent"
End Sub

Sub Change_ActiveCell_Value_As_Percent()
ActiveCell.Value = "%"
End Sub


Sub Auto_Close()
Application.OnKey "{ALT}"
End Sub


Can somebody tell me where is the mistake? Or what should be my correct solution?

Thanks a lot.:)

Cyberdude
09-25-2006, 09:01 PM
Something to try:

Instead of {ALT} use {%}. The "%" in braces is unrelated to the "%" you want to display.

Jacob Hilderbrand
09-25-2006, 09:06 PM
Alt cannot be used by itself with OnKey.

Erdin? E. Ka
09-26-2006, 05:44 AM
Something to try:

Instead of {ALT} use {%}. The "%" in braces is unrelated to the "%" you want to display.

I tried it but i got negative result, thank you Cyberdude for your kindly interest and help. :friends:

-----


Alt cannot be used by itself with OnKey.

Thanks DRJ, so is there a different way except On.Key Method to get a solution about the matter?

Kindly Regards.:)