Microsoft KB Archive/277808

From BetaArchive Wiki
Knowledge Base


Article ID: 277808

Article Last Modified on 1/29/2007



APPLIES TO

  • Microsoft Excel 2002 Standard Edition



This article was previously published under Q277808

SYMPTOMS

When you attempt to use the Text to Speech feature in a macro, you receive an error message similar to the following:

Run-time error '1004':

Application-defined or object-defined error

CAUSE

This error message occurs if the Text to Speech feature for Excel is not installed on the computer.

WORKAROUND

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

Sample Code

The following sample code demonstrates how to use error handling to bypass the run-time error that occurs if Text to Speech is not installed:

Sub SayHello()
    
    On Error GoTo handler
    Application.Speech.Speak ("Hello")
    
handler:
    If Err.Number = 1004 Then
        MsgBox "This macro requires Text to Speech to be installed."
    End If
End Sub
                

MORE INFORMATION

By default, the Text to Speech feature is not installed when you install Excel; it is installed the first time that you attempt to use the feature. Therefore, if you want to use Text to Speech in a custom solution, your program must make sure that Text to Speech is already installed on the target computer.

NOTE: Microsoft Excel 2002 is the only program in the Microsoft Office suite that has Text to Speech functionality. To use Text to Speech in other Office programs, you must use an Excel object.

REFERENCES

For additional information about how to use an Excel object for Text to Speech, click the article number below to view the article in the Microsoft Knowledge Base:

287120 OFFXP: How to Automate Excel to Use Text to Speech from Another Office Program



Additional query words: inf XL2002 prb

Keywords: kbenable kbenablesight kberrmsg kbprb KB277808