Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can't Copy and Paste or Paste Special between Excel Workbooks | Excel Discussion (Misc queries) | |||
Copy, paste without file name referenced after paste | Excel Discussion (Misc queries) | |||
Excel cut/Paste Problem: Year changes after data is copy and paste | Excel Discussion (Misc queries) | |||
I cannot paste from one workbook to another. Copy works, paste do. | Excel Discussion (Misc queries) | |||
Copy and Paste macro needs to paste to a changing cell reference | Excel Programming |