ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Test if clipboard empty (https://www.excelbanter.com/excel-programming/428270-test-if-clipboard-empty.html)

CLR

Test if clipboard empty
 
Hi All......
This works fine in XL2k if there is something on the Clipboard, but fails
with "Run time Error" if the clipboard is empty.......

CommandBars("clipboard").Controls("clear clipboard").Execute

How might I word an IF statement to check if the Clipboard is empty or not?

TIA
Vaya con Dios,
Chuck, CABGx3



Dave Peterson

Test if clipboard empty
 
I bet you could look at one of the icons on that toolbar to see if it's enabled,
but I'd just weasel out and do:

On error resume next
'your command
on error goto 0



CLR wrote:

Hi All......
This works fine in XL2k if there is something on the Clipboard, but fails
with "Run time Error" if the clipboard is empty.......

CommandBars("clipboard").Controls("clear clipboard").Execute

How might I word an IF statement to check if the Clipboard is empty or not?

TIA
Vaya con Dios,
Chuck, CABGx3


--

Dave Peterson

Barb Reinhardt

Test if clipboard empty
 
I thought that command bars are no longer used in 2007. Was I mistaken?

"Dave Peterson" wrote:

I bet you could look at one of the icons on that toolbar to see if it's enabled,
but I'd just weasel out and do:

On error resume next
'your command
on error goto 0



CLR wrote:

Hi All......
This works fine in XL2k if there is something on the Clipboard, but fails
with "Run time Error" if the clipboard is empty.......

CommandBars("clipboard").Controls("clear clipboard").Execute

How might I word an IF statement to check if the Clipboard is empty or not?

TIA
Vaya con Dios,
Chuck, CABGx3


--

Dave Peterson


Peter T

Test if clipboard empty
 
Indeed, in 2007 Commandbars have been replaced by the "Ribbon" as the UI,
although they do still exist to some extent. However since 2003 (possibly
2002 ?) the clipboard is shown in the "Task Pane".

For all versions I think simply the following should be enough

Application.CutCopyMode = False

Regards,
Peter T


"Barb Reinhardt" wrote in message
...
I thought that command bars are no longer used in 2007. Was I mistaken?

"Dave Peterson" wrote:

I bet you could look at one of the icons on that toolbar to see if it's
enabled,
but I'd just weasel out and do:

On error resume next
'your command
on error goto 0



CLR wrote:

Hi All......
This works fine in XL2k if there is something on the Clipboard, but
fails
with "Run time Error" if the clipboard is empty.......

CommandBars("clipboard").Controls("clear clipboard").Execute

How might I word an IF statement to check if the Clipboard is empty or
not?

TIA
Vaya con Dios,
Chuck, CABGx3


--

Dave Peterson




Dave Peterson

Test if clipboard empty
 
I've seen people that complain that it doesn't always work (but I don't use the
office clipboard).

Maybe the routine at Chip Pearson's site will work:
http://www.cpearson.com/excel/Clipboard.aspx
look for: EmptyClipboard

Peter T wrote:

Indeed, in 2007 Commandbars have been replaced by the "Ribbon" as the UI,
although they do still exist to some extent. However since 2003 (possibly
2002 ?) the clipboard is shown in the "Task Pane".

For all versions I think simply the following should be enough

Application.CutCopyMode = False

Regards,
Peter T

"Barb Reinhardt" wrote in message
...
I thought that command bars are no longer used in 2007. Was I mistaken?

"Dave Peterson" wrote:

I bet you could look at one of the icons on that toolbar to see if it's
enabled,
but I'd just weasel out and do:

On error resume next
'your command
on error goto 0



CLR wrote:

Hi All......
This works fine in XL2k if there is something on the Clipboard, but
fails
with "Run time Error" if the clipboard is empty.......

CommandBars("clipboard").Controls("clear clipboard").Execute

How might I word an IF statement to check if the Clipboard is empty or
not?

TIA
Vaya con Dios,
Chuck, CABGx3

--

Dave Peterson


--

Dave Peterson

CLR

Test if clipboard empty
 
Many thanks Dave........your suggestion does the job just fine!

Vaya con Dios,
Chuck, CABGx3


"Dave Peterson" wrote in message
...
I bet you could look at one of the icons on that toolbar to see if it's
enabled,
but I'd just weasel out and do:

On error resume next
'your command
on error goto 0



CLR wrote:

Hi All......
This works fine in XL2k if there is something on the Clipboard, but fails
with "Run time Error" if the clipboard is empty.......

CommandBars("clipboard").Controls("clear clipboard").Execute

How might I word an IF statement to check if the Clipboard is empty or
not?

TIA
Vaya con Dios,
Chuck, CABGx3


--

Dave Peterson




CLR

Test if clipboard empty
 
I've heard that too Barb, but in this case I'm using XL2000, so Dave's
suggestion worked for me.

Vaya con Dios,
Chuck, CABGx3


"Barb Reinhardt" wrote in message
...
I thought that command bars are no longer used in 2007. Was I mistaken?

"Dave Peterson" wrote:

I bet you could look at one of the icons on that toolbar to see if it's
enabled,
but I'd just weasel out and do:

On error resume next
'your command
on error goto 0



CLR wrote:

Hi All......
This works fine in XL2k if there is something on the Clipboard, but
fails
with "Run time Error" if the clipboard is empty.......

CommandBars("clipboard").Controls("clear clipboard").Execute

How might I word an IF statement to check if the Clipboard is empty or
not?

TIA
Vaya con Dios,
Chuck, CABGx3


--

Dave Peterson





All times are GMT +1. The time now is 10:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com