PDA

View Full Version : Solved: Detect key press in document using vba



Carsten
04-04-2010, 05:29 AM
Hi

How can I detect when a user press the F4 button in a document

I want to show the user a message when he/she hit F4

Best Regards
Carsten

Paul_Hossler
04-05-2010, 06:26 PM
In a standard module, just add your own EditRedoOrRepeat sub


Option Explicit
Sub EditRedoOrRepeat()

MsgBox "Add your message here"
End Sub


That works until someone changes the key-to-command customizations

I have 2007, but back saved to 2003 so it 'should' work

Paul

Carsten
04-06-2010, 12:30 AM
Hi Paul

Thanks, it works perfect :hi:

Carsten

Paul_Hossler
04-06-2010, 06:37 AM
Good.

Excel has a much more robust .Onkey that Word does

Don't forget to mark your thread 'Solved' using 'Thread Tools' at the top

Paul

Carsten
04-06-2010, 07:27 AM
Thanks again

Carsten