Disable menubar items in 2007

M

MPMM

I have been using Automation to manage access to some of the menubar items in
Office XP.

For example I use the following code to disable all the instances of the
copy command:

//coontrol ID 19 = copy
copyCmds =
oDoc.ActiveWindow.Document.CommandBars.FindControls(MsoControlType.msoControlButton, 19, null, null);
foreach (CommandBarControl copyCmd in copyCmds)
{
copyCmd.Enabled = false;
}

This works perfectly in Office XP but when I try to run this in Word 2007
the Copy command in the ribbon does not get disabled (other copy command such
as the pop up edit menu are disabled as expected).

Is it possible to disable specific menubar items in 2007 in this way?

Is it possible at all in 2007?

TIA

Craig
 
A

Andrei Smolin [Add-in Express]

Hello Craig,
Is it possible to disable specific menubar items in 2007 in this way?

No, it isn't. Word 2007 doesn't use command bar controls. Instead, it uses
Ribbon controls.
Is it possible at all in 2007?

Yes, it is. I've just created a sample Add-in Express add-in (HostApp=Word),
add a RibbonCommand component(CopyRibbonCommand) to the AddinModule, and set
its properties:
CopyRibbonCommand.IdMso = "Copy"
CopyRibbonCommand.Enabled = False

This disables the Copy command in Word. This is reflected in the Ribbon and
context menu. Ctrl+C is disabled, too.

Internally, the RibbonCommand component uses the <command /> tag and
implements appropriate callbacks.

Regards from Belarus,

Andrei Smolin
Add-in Express Team Leader
www.add-in-express.com
 
P

Padmasri

Hi,
I never worked on Add-in. So could you please explain me how to add a
Ribboncommand component in VB6. Me too have the same problem. The code works
fine for 2000, XP and 2003. But it is not working for 2007. I need this info.
Please give a detailed mail which will be very helpful to me.
Thanks and regards,
Padmasri.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top