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
|