View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default If clipboard is empty..

Hi Tonso,

Am Mon, 20 Jul 2015 04:19:39 -0700 (PDT) schrieb Tonso:

I have an XL 2013 workbook into which I paste data from an intranet webpage.
If a user forgets to copy the data before invoking the macro that pastes the data into the workbook and manipulates it, they get the Run-time error 1004.
When the user invokes the macro with the clipboard empty, I would like foe the macro to either end, or better yet, activate a message-box that tell the user what the problem is [empty clipboard], then exits the macro. How can I accomplish this?


try:

If Application.ClipboardFormats(1) = -1 Then
MsgBox "Clipboard is empty"
Exit Sub
End If


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional