How can I make the Excel cell menu update when the keyboard's context menu key is pressed
At the moment, I have code that runs in the Application's SheetBeforeRightClick event, but I've found that this code doesn't run when I press the keybo开发者_StackOverfloward's Context Menu key instead of using the right mouse button, which means that I get the wrong menu.
I could use the SheetSelectionChange event instead, but I'd imagine this would be quite error prone. Is there a more elegant way of doing it?
There is a BeforeContextMenu event you can use.
http://msdn.microsoft.com/en-us/library/aa193082(office.11).aspx
It should catch both the right click and the keyboard key.
精彩评论