Add The Speech Controls To The Ribbon

Category: CommandBars & Menus | [Item URL]

A companion file is available: Click here to download

For some reason, the text-to-speech controls are not included in the Excel 2007 ribbon UI. Those who want to use these tools must add them to their Quick Access Toolbar.

This tip describes how to create a simple add-in that, when installed, displays the text-to-speech controls in the Review tab of the ribbon. These controls are in a new group (labeled Text to Speech), which is positioned between the Proofing group and the Comments group.

The new ribbon group contains six controls. The first five are built-in commands, so they don't require any callbacks. The last one, Voice, is a custom control. When clicked, it executes a VBA procedure that displays the Speech Properties dialog box from the Windows Control Panel. This dialog box lets you choose a different voice and control the speed of the voice.

I used the Custom UI Editor Tool to add the following RibbonX code that displays the new ribbon group:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab idMso="TabReview">
<group id="SpeechGroup" label="Text to Speech" insertBeforeMso="GroupComments">
<control idMso="SpeakCells" size="large" />
<control idMso="SpeakStop" size="large" />
<separator id="sep1" />
<control idMso="SpeakOnEnter" size="normal" />
<control idMso="SpeakByRows" size="normal" />
<control idMso="SpeakByColumns" size="normal" />
<button id ="RunSapi" label="Voice" imageMso = "DirectRepliesTo" onAction="RunSapiApp" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>

The VBA procedure that is executed when the Voice button is clicked is defined like this:

Sub RunSapiApp(control As IRibbonControl)
 ' code here
End Sub

As it turns out, displaying the Sapi.cpl Control Panel dialog box is not as simple as displaying other control panel dialogs -- and I'm not certain that it will work on all systems. If you're interested, you can download the add-in and view the code.


Search for Tips


All Tips

Browse Tips by Category

Tip Books

Needs tips? Here are two books, with nothing but tips:

Contains more than 100 useful tips and tricks for Excel 2013 | Other Excel 2013 books | Amazon link: 101 Excel 2013 Tips, Tricks & Timesavers

Contains more than 200 useful tips and tricks for Excel 2007 | Other Excel 2007 books | Amazon link: John Walkenbach's Favorite Excel 2007 Tips & Tricks

© Copyright 2016, J-Walk & Associates, Inc.
Privacy Policy