ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trap CTRL+C keypress event (https://www.excelbanter.com/excel-programming/289723-trap-ctrl-c-keypress-event.html)

Nick

Trap CTRL+C keypress event
 
Is there a way to trap the CTRL+C (Window's copy event) in
Excel 2000. I want to know when a user press the CTRL+C,
what is the cell(s) address or range.


Jim Rech

Trap CTRL+C keypress event
 
You use OnKey to attach a macro to a key press (supplanting the default
behavior).

So..

Sub TrapCtrlC()
Application.OnKey "^c", "MyCopyMacro"
End Sub

Sub MyCopyMacro()
'Your code here
End Sub

--
Jim Rech
Excel MVP



hasan Nazeer

Trap CTRL+C keypress event
 
I tried placing the code, and press CTRL+C, the event did not fire. Do I
need to do anything else besides placing the code?



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

hasan Nazeer

Trap CTRL+C keypress event
 
Thx, I placed the code in Auto_Open macro and it is working.




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Beto[_3_]

Trap CTRL+C keypress event
 
hasan Nazeer wrote:

I tried placing the code, and press CTRL+C, the event did not fire. Do I
need to do anything else besides placing the code?


You need to execute it once.

Regards,
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.



All times are GMT +1. The time now is 11:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com