MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Urgent......How do customize the 'Paste'operation...

Posted by Kishan on January 03, 2001 12:12 PM


I have written a procedure 'Paste_Spec' to overwrite the
default Copy operation as follows:

This is for 'Edit-Paste':

CommandBars("Cell").Controls("&Paste").OnAction = "Paste_spec"

This is for Paste icon on the standard toolbar:

CommandBars("Standard").Controls("Paste").OnAction = "Paste_spec"

But in the excel sheet when I select the 'Edit-Paste' using mouse
the above 'Paste_Spec' procedure is not being fired.

Also how do I enable/disable Paste operation that appears in the
pop up menu when we right click the mouse button.

Anyone can please tell me why is it so.....

I need your urgent help........

THanks a lot.........

Posted by Tim Francis-Wright on January 03, 2001 12:39 PM

application.CommandBars("cell").controls("Paste").OnAction = "YourMacro"
'changes Paste on right-mouse-click menu to YourMacro

' changes it back

The cell commandbar appears when you have a cell or cells selected...
however, if you select an entire row or column,
the row or column commandbar appears.

So, you probably want to add code:
application.CommandBars("row").controls("Paste").OnAction = "YourMacro"
application.CommandBars("column").controls("Paste").OnAction = "YourMacro"

There might be some other commandbar in question;
if you find that Paste isn't being remapped,
make sure that you haven't overlooked a relevant

Hope this helps!