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 |
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 |
All times are GMT +1. The time now is 01:54 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com