anakic
anakic

Reputation: 2978

VSTO override Excel hotkeys inside custom task pane

Is it possible to override Excel keyboard shortcuts inside a custom task pane?

For instance I would like to capture the shortcut Ctrl+Space, but Excel already uses that shortcut inside a custom task pane, and the shortcut never reaches the KeyPressed event handler on my user control.

Other key combinations that Excel doesn't use reach my event handler just fine.

Is there a way to override this, maybe via the Windows API?

Upvotes: 0

Views: 332

Answers (1)

Eugene Astafiev
Eugene Astafiev

Reputation: 49395

You can use the SetWindowsHookEx function from Windows API to set up a keyboard hook. But overriding the built-in keyboard shortcut is not a good idea. Anyway, you can read more about this and find a sample code in the Using shortcut keys to call a function in an Office Add-in article.

Upvotes: 1

Related Questions