Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Copy ... Paste

Hello,

Is there a way to test for data to be pasted?

I have a rightclick menu item 'Paste Values' to replace 'Paste' but I
want to grey it out when there is no data to be pasted. And enable it back
when there is data available to be pasted. Any help would be great...

Thanks,
Ernst.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Copy ... Paste

"Ernst Guckel" wrote in message
...
Is there a way to test for data to be pasted?

I have a rightclick menu item 'Paste Values' to replace 'Paste' but I
want to grey it out when there is no data to be pasted. And enable it
back
when there is data available to be pasted. Any help would be great...


Hi Ernst,

In this particular case, the easiest thing to do would be to have Excel
handle this for you automatically. There is a built-in Paste Values command
bar control you can add to your menu that will be enabled/disabled
appropriately based on whether there is data in the clipboard. You can add
this control to your CommandBar using its ID number 370, like so:

Dim ctlMenu As CommandBarButton
Set ctlMenu = CommandBars("MyBar").Controls.Add(ID:=370)
ctlMenu.Style = msoButtonIconAndCaption

There is no need to assign a macro to this control, since it already knows
how to perform a paste special values.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Copy ... Paste

Thanks a bunch.

Ernst.


"Rob Bovey" wrote:

"Ernst Guckel" wrote in message
...
Is there a way to test for data to be pasted?

I have a rightclick menu item 'Paste Values' to replace 'Paste' but I
want to grey it out when there is no data to be pasted. And enable it
back
when there is data available to be pasted. Any help would be great...


Hi Ernst,

In this particular case, the easiest thing to do would be to have Excel
handle this for you automatically. There is a built-in Paste Values command
bar control you can add to your menu that will be enabled/disabled
appropriately based on whether there is data in the clipboard. You can add
this control to your CommandBar using its ID number 370, like so:

Dim ctlMenu As CommandBarButton
Set ctlMenu = CommandBars("MyBar").Controls.Add(ID:=370)
ctlMenu.Style = msoButtonIconAndCaption

There is no need to assign a macro to this control, since it already knows
how to perform a paste special values.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
Copy, paste without file name referenced after paste AusTexRich Excel Discussion (Misc queries) 6 September 23rd 08 02:57 AM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
I cannot paste from one workbook to another. Copy works, paste do. JimmyMc Excel Discussion (Misc queries) 1 June 10th 05 03:54 PM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM


All times are GMT +1. The time now is 10:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"