Microsoft Office Tutorials and References
In Depth Information
Making Excel Talk
Making Excel Talk
This tip describes how to make Excel monitor a particular cell and give a verbal report using
the text-to-speech feature when the value changes. The tip uses an event-handler macro —
specifically, a macro named Worksheet_Calculate.
See Tip 38 for more about using the text-to-speech options in Excel.
The Worksheet_Calculate macro must be placed in the code module for the worksheet that
contains the cell that’s being monitored. The easiest way to activate that code module is to
rightclick the sheet tab and choose View Code from the shortcut menu.
The following code assumes that cell A1 contains a total and is the cell that’s being monitored.
The listing uses a different phrase for each of six conditions. For example, if cell A1 contains the
value 1,050, Excel says “You’re over the budget.”
You can, of course, add as many conditions as you like and adjust the numeric ranges to handle
other conditions.
Private Sub Worksheet_Calculate()
With Application.Speech
Select Case Range(“A1”)
Case Is < 600: .Speak “Way below the budget”
Case 601 To 900: .Speak “Within the budget”
Case 901 To 999: .Speak “Getting close to the budget”
Case 1000: .Speak “You are exactly at the budget”
Case 1001 To 1100: .Speak “You are over the budget”
Case Is > 1100: .Speak “You are going to get fired”
End Select
End With
End Sub
 
Search JabSto ::




Custom Search