Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default OnKey Method


I need help with the onkey method. I can not get it to work.

I have created a userform, label and macro named UserForm1, lblPress
and Functest respectively. Here is my code. What am I doing wrong?

Private Sub UserForm_Initialize()
Application.OnKey "{F10}", "functest"
End Sub
----------------------------------------------------------------------
Private Sub UserForm_Terminate()
Application.OnKey "{F10}"
End Sub
----------------------------------------------------------------------
Sub functest()
Const conMsg As String = "You have pressed F10"

lblPress.Caption = conMsg

End Su

--
Tha BeatMake
-----------------------------------------------------------------------
Tha BeatMaker's Profile: http://www.excelforum.com/member.php...fo&userid=2399
View this thread: http://www.excelforum.com/showthread.php?threadid=39749

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default OnKey Method

Its hard to advise here, but:

1. make sure your stuff is in the ThisWorkbook module
2. you might need private sub workbook_open() to do the initialization
--
Gary's Student


"Tha BeatMaker" wrote:


I need help with the onkey method. I can not get it to work.

I have created a userform, label and macro named UserForm1, lblPress,
and Functest respectively. Here is my code. What am I doing wrong?

Private Sub UserForm_Initialize()
Application.OnKey "{F10}", "functest"
End Sub
----------------------------------------------------------------------
Private Sub UserForm_Terminate()
Application.OnKey "{F10}"
End Sub
----------------------------------------------------------------------
Sub functest()
Const conMsg As String = "You have pressed F10"

lblPress.Caption = conMsg

End Sub


--
Tha BeatMaker
------------------------------------------------------------------------
Tha BeatMaker's Profile: http://www.excelforum.com/member.php...o&userid=23998
View this thread: http://www.excelforum.com/showthread...hreadid=397499


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
onkey method freekrill Excel Discussion (Misc queries) 1 October 12th 05 01:31 PM
OnKey Method cottage6 Excel Programming 1 October 20th 04 05:56 PM
Problem mapping procedure using OnKey Method Adrian[_7_] Excel Programming 1 August 4th 04 12:58 PM
Onkey Method Fred Lambelet Excel Programming 3 January 23rd 04 05:20 AM
Onkey Jase Excel Programming 1 November 17th 03 11:07 PM


All times are GMT +1. The time now is 10:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"