Discussion:
If clipboard is empty..
(too old to reply)
Tonso
2015-07-20 11:19:39 UTC
Permalink
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?

Thanks,
Tonso
Claus Busch
2015-07-20 12:23:37 UTC
Permalink
Hi Tonso,
Post by 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
Tonso
2015-07-21 11:20:42 UTC
Permalink
Post by 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?
Thanks,
Tonso
Claus,
Thanks! Works perfect!
Tonso

Loading...