Help and Support
 

powered byLive Search

XL2002: "Run-time Error 1004" When You Attempt to Use Text to Speech in Macro

Article ID:277808
Last Review:January 29, 2007
Revision:3.3
This article was previously published under Q277808
On This Page

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

Back to the top

CAUSE

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

Back to the top

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.

Back to the top

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
				

Back to the top

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.

Back to the top

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 (http://support.microsoft.com/kb/287120/EN-US/) OFFXP: How to Automate Excel to Use Text to Speech from Another Office Program

Back to the top


APPLIES TO
Microsoft Excel 2002 Standard Edition

Back to the top

Keywords: 
kbenable kbenablesight kberrmsg kbprb KB277808

Back to the top

Article Translations

 

Related Support Centers

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.