Hi guyz,
My second post on this awesome forum
Can I control the OnAction of the PASTE button on the standard commandbar. I'm able to control the same for Paste option under the EDIT menu as well as the Paste option on the right-click menu via the following set of instructions:
Code
'Customizing the PASTE option under EDIT menu
Sub CustomizeEditMenu()
CommandBars("Edit").Controls("&Paste").OnAction = "PasteValuesOnly"
End Sub
'Customizing the right-click menu
Sub CustomizeRightClickMenu()
For Each ctrl In Application.CommandBars("Cell").Controls
If ctrl.Caption <> "&Copy" And ctrl.Caption <> "&Paste" Then
CommandBars("Cell").Controls(ctrl.Caption).Delete
End If
Next ctrl
CommandBars("Cell").Controls("&Paste").OnAction = "PasteValuesOnly"
End Sub
'Macro for OnAction
Sub PasteValuesOnly()
Selection.PasteSpecial xlPasteValues
End Sub
Display More
However when I add:
to the CustomizeEditMenu subroutine a run-time error '438' - OBJECT DOESN'T SUPPORT THIS PROPERTY OR METHOD appears
I have tried searching on the forum as well but maybe I'm not searching the right threads.
I'm going crazy figuring this one out...I'll appreciate all you GURUS to try 'n help me maintain my sanity :yikes:
ThanX in advance
Rana