Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old December 30th 20, 09:36 AM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Oct 2018
Posts: 8
Default Handle keyboard events

How can I detect when a user presses Ctrl+Alt+G (or any similar key combination) while any worksheet is active? Thanks

  #2   Report Post  
Old December 31st 20, 03:56 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2019
Posts: 79
Default Handle keyboard events

"Tatsujin" wrote in message
How can I detect when a user presses Ctrl+Alt+G (or any similar key
combination) while any worksheet is active? Thanks


If you only want to trap one or perhaps a handful of key combinations use
Application.OnKey

https://docs.microsoft.com/en-us/off...lication.onkey

Sub CtrlAltG(bInit As Boolean)
Application.OnKey "^%g", IIf(bInit, "TestCtrlAltG", "")
End Sub

Sub TestCtrlAltG()
MsgBox "TestCtrlAltG"
End Sub

Don't forget to clear any OnKeys when done, for example in the workoks close
event

For something more general purpose look into use of the GetAsyncKeyState
API, though Alt strokes probably won't pass through the sheet, so to speak.
Some examples from long ago!

https://groups.google.com/g/microsof...tAsyncKeyState

Peter T




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
Is there a keyboard shortcut to fill handle a large # of cells? Erin Excel Discussion (Misc queries) 2 December 22nd 09 02:13 AM
What is keyboard shortcut equivalent to drag the fill handle JZ Excel Discussion (Misc queries) 2 July 31st 06 06:25 AM
Keyboard command to replace double clicking the fill handle Pat Excel Discussion (Misc queries) 1 May 18th 05 05:50 PM
How to handle all delete row events in excel Tom Hughes Excel Programming 0 October 22nd 04 07:24 PM
Office2003: Handle events for web charting component Sunil K Excel Programming 0 February 9th 04 03:26 PM


All times are GMT +1. The time now is 09:29 PM.

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

About Us

"It's about Microsoft Excel"

 

Copyright © 2017