Microsoft KB Archive/161332

= OFF97: Exception Error When You Reference Application Object on a Microsoft Windows NT 4.0-based Computer =

Article ID: 161332

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Office 97 Standard Edition, when used with:
 * Microsoft Windows NT 4.0
 * Microsoft Access 97 Standard Edition
 * Microsoft Excel 97 Standard Edition
 * Microsoft PowerPoint 97 Standard Edition

-



This article was previously published under Q161332



Advanced: Requires expert coding, interoperability, and multiuser skills.



SYMPTOMS
When you reference the Application object of an Automation server, such as Microsoft Access 97, Microsoft Excel 97, or Microsoft Word 97, you may receive the following Dr. Watson error message on a computer that is running Microsoft Windows NT 4.0, Service Pack 1:

An Application error has occurred and an application log is being generated.

MSACCESS.exe

Exception: (0x000006e6), Address: 0x77e2f4c7

The error message includes a reference to the executable file for the application that was running the Automation code, in this instance, Msaccess.exe.

In Microsoft PowerPoint 97, you may receive the following error message:

PowerPoint found an error that it can't correct.

You should save your presentations, exit and then restart

PowerPoint.



CAUSE
Microsoft has confirmed that this is a problem in Microsoft NT version 4.0, Service Pack 1.



RESOLUTION
This problem occurs only on a computer that is running Microsoft Windows NT 4.0, Service Pack 1. To resolve this problem, obtain the latest service pack for Windows NT 4.0. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

152734 How to Obtain the Latest Windows NT 4.0 Service Pack

NOTE: If you intend to install the Service Release for Office 97, you must first upgrade your system to Windows NT Service Pack 2 or later.



WORKAROUND
To temporarily work around this problem, change your code to use late binding. Late binding occurs when you declare a variable as an object rather than as an application, for example: Sub XLTest

Dim xlApp as Object Set xlApp = CreateObject("Excel.Application") xlApp.Visible = True xlApp.Workbooks.Open "c:\Program Files\Microsoft " _ & "Office"\Office\Examples\Samples.xls"

End Sub



MORE INFORMATION
This error occurs when you use the New keyword to create an instance of an Office 97 application, or you try to use early binding to an Office 97 application. Early binding declares a variable as a Programmatic Identifier (ProgID) rather than as an Object or a Variant.

Steps to Reproduce Problem
WARNING: Following these steps will cause an exception error on your computer. Make sure you save and close any open work on your computer before following these steps.  Start Microsoft Access 97 on a computer that is running Microsoft Windows NT 4.0 SP1. Open the sample database Northwind.mdb.  Create a module, and then type the following procedure: Sub XLTest

Dim xlAppj as New Excel.Application xlApp.Visible = True xlApp.Workbooks.Open "c:\Program Files\Microsoft " _ & "Office"\Office\Examples\Samples.xls"

End Sub  In Design view of the module, click References on the Tools menu. Click to select the Microsoft Excel 8.0 Object Library check box in the Available References dialog box, and then click OK. If Microsoft Excel 8.0 Object Library is not in the list, click Browse, and then search your hard disk for the Excel8.olb file.</li>  To test this procedure, type the following line in the Debug window, and then press ENTER: XLTest Note that you receive the exception error. </li>  The following code uses early binding, which creates the error: Sub XLTest

Dim xlAppj as Excel.Application Set xlApp = CreateObject("Excel.Application") xlApp.Visible = True xlApp.Workbooks.Open "c:\Program Files\Microsoft " _ & "Office"\Office\Examples\Samples.xls"

End Sub </li></ol>

<div class="references_section">