View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John Keith[_2_] John Keith[_2_] is offline
external usenet poster
 
Posts: 175
Default Why does this code not work?

Attempting to make the regular enter key behave as if you press Alt-Enter, in
responce to someones post about how to do this.

Pressing the standard enter key (not the numeric keypad enter) causes an
infinite loop. The screen flickers with an hour-glass after pressing enter.
Ctrl-Break stops the code and it is always on the Sub AltEnterRtn() line.

Can anyone explain what is going on behind the scenes that causes this?

Sub SetKey()
Application.OnKey "~", "AltEnterRtn"
End Sub
Sub ResetKey()
Application.OnKey "~"
End Sub
Sub AltEnterRtn()
Application.SendKeys "%~", True
End Sub
--
Regards,
John