Microsoft Excel - I want to disable the menu item Cut,Copy and Paste in Excel 2010 at run time using VBA?

Asked By Tausif K on 19-Sep-13 08:58 AM
Hi Experts,

I would like to know if there is any code to Enable/Disable Cut,Copy and Paste options from Menu Bar in Excel 2010 using VBA.

I have the code that works and Enable/Disable the menu items in Excel 2003, but that code is not working for excel 2010.

Is there a way to disable/Enable the Menu Items. I have searched many sites and forums but not getting answers as expected.

Tausif K.
Harry Boughen replied to Tausif K on 19-Sep-13 05:34 PM
Hello Tausif K,
This page and the links from it might help you to do something of what you want.

Tausif K replied to Harry Boughen on 20-Sep-13 02:30 AM
Hi Harry,

Thanks for your reply. But let me explain you that i already checked the msdn and other sites.

I got the solution for hiding the Tabs but not for the menu items such as Cut, copy and Paste,etc.

Also, i would like to know, how the XML files are created and called through VBA.

I can see the RibbonX XML files but not getting how and where to implement.

What i understand is, I have to create the text file by extension as .xml (to the desired location), but no idea how the file is linked or called.

Waiting for your reply.

Harry Boughen replied to Tausif K on 20-Sep-13 05:48 AM
Hello Tausif K,
This page seems to give a blow by blow description of the process.  Although it refers to Office 2007, I would think that 2010 would be pretty much the same.

This page refers to an add-in that you can get that might make it easier.

In the earlier references that I gave you, the files that you can download have examples of hiding groups on a Tab but not individual controls (Hide-display-Built-in Tab-Group.xlsm).  Maybe you will have to get the controls that you want to hide into a customised group and hide that.
Tausif K replied to Harry Boughen on 20-Sep-13 07:20 AM
Hello Harry,

I understand what you are trying to explain me.

But if you see the example ( (Hide-display-Built-in Tab-Group.xlsm) in that the tabs are created.

When you see Home Ribbon, Cut, Copy and Paste are built in tabs which is not getting disabled.

I want to disable the same. I have the code which disable Cut,Copy and Paste menu items in Excel 2003.

The same i want to make work in Excel 2010.

Tausif K.
Harry Boughen replied to Tausif K on 20-Sep-13 08:31 AM
Hello Tausif K,
I'm not really familiar with this but the controls that you want to hide are contained in a Group called Clipboard.
So, I am imagining that the fragment of xml required would look something like:

<tab idMso="TabHome" >
<group idMso="GroupClipboardExcel" getVisible="GetVisible" />
Then you would need to make the relevant changes to the VBA.  In the example file these are associated with the buttons for demonstration purposes but this could be triggered by whatever means you require.
You would have to find out the actual name for the Clipboard Group if my presumption is not correct.
From what I have been able to find, it does not appear that you can address individual controls - only groups and tabs (and possibly the whole ribbon)