#1   Report Post  
Posted to microsoft.public.excel.programming
jim jim is offline
external usenet poster
 
Posts: 19
Default Sendkeys

Hi I cant work out which worksheet function to use to
spark off some code if the button F6 is pressed.

I know it is something like -

Sub Worksheet_Whats this??()

If Application.SendKeys(vbKeyF6) Then
MsgBox ("you pressed F6")
End
End If

End Sub

Thanks
Jim
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Sendkeys

Look at application.onkey.

Option Explicit
Sub RunMyF6Macro()
Application.OnKey "{f6}", "RunMyF6"
End Sub

Sub RunMyF6()
MsgBox "hi from F6"
End Sub

'And this would toggle it back to normal.
Sub PutItBack()
Application.OnKey "{f6}"
End Sub




Jim wrote:

Hi I cant work out which worksheet function to use to
spark off some code if the button F6 is pressed.

I know it is something like -

Sub Worksheet_Whats this??()

If Application.SendKeys(vbKeyF6) Then
MsgBox ("you pressed F6")
End
End If

End Sub

Thanks
Jim


--

Dave Peterson
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
SendKeys? CMK Excel Programming 2 February 23rd 05 12:03 AM
SendKeys Mike Excel Programming 2 July 2nd 04 12:47 AM
Sendkeys GB[_3_] Excel Programming 0 September 16th 03 10:39 PM
SendKeys Ron de Bruin Excel Programming 3 August 25th 03 10:21 PM
sendkeys mark poole Excel Programming 0 July 11th 03 03:47 PM


All times are GMT +1. The time now is 05:15 PM.

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"