![]() |
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. |
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 |
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 |
All times are GMT +1. The time now is 01:59 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com