How to create a ribbon button to show the Signatures pane in Word

The aim

I want to create a button on a customized ribbon in Microsoft Word to display the Signatures pane.

The problem: using idMso FileViewDigitalSignatures doesn't work

Microsoft provides a download that lists of all the control IDs for built-in controls on the Word ribbon.

That file lists the command that should show the Signatures pane: FileViewDigitalSignatures. In the Word user interface, it's a toggleButton on the File > Prepare menu.

You can use the Word 2010 ‘Customize the Ribbon’ tool to add this command to a custom group on a custom tab. It's the command listed as “View Signatures”. And it works. When the button is clicked, Word displays the Signatures pane.

So I try to add this command by customizing the ribbon in code using

<toggleButton idMso="FileViewDigitalSignatures" /> <!-- this doesn't work -->

The command is completely ignored. No error is raised. The toggleButton just doesn’t appear.

So, I think, I'll just create a button re-using the relevant image (imageMso="FileViewDigitalSignatures"). And I'll invoke the command directly using .ExecuteMso.

But that doesn't work, either. If I use something like

Application.CommandBars.ExecuteMso("FileViewDigitalSignatures") ' this doesn't work

I get an unspecified automation error.

That's because .ExecuteMso only works on a control that is both visible and enabled, according to Microsoft's object model documentation. I can't make the control visible, so I can't use .ExecuteMso.

Similarly, if I use

Application.CommandBars("Signatures").Visible = True ' this doesn't work

I get an unspecified automation error.

Workaround

There is a workaround: create a custom button on the ribbon, use the built-in image (imageMso = "FileViewDigitalSignatures") and get its click callback to run something like

Application.TaskPanes(wdTaskPaneSignature).Visible = True

Related pages

Change the Ribbon in Excel 2007 or Excel 2010 by Excel MVP Ron de Bruin. This is an excellent introduction to customizing the Ribbon. It's geared to Excel, but applies also to Word.