View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Spaan Spaan is offline
external usenet poster
 
Posts: 1
Default Check if clipboard is empty before .PasteSpecial xlPasteValues

I use the sub auto_open() to prevent format to be copied in a copy paste.
With Application
.OnKey "^v", "ValueOnly"
End With

and then this function:
Function ValueOnly()
Selection.PasteSpecial xlPasteValues
End Function

However, the code failes when trying to paste when no cells are highlighted
(you know, after control-C for example). Probably the clipboad is empty which
causes the error. How do I check if the clipboard is empty so I can prevent
the error from happening? Or should I use On Error code to catch such an
event?

Furthermore, is there a way to capture the paste event when used through the
rightclick-menu, edit-menu and button?
(Excel97)