PRB: GeoFacts Sample Causes Automation Error on NT

Last reviewed: December 16, 1997
Article ID: Q178167
The information in this article applies to:
  • Microsoft Visual Basic Professional and Enterprise Editions for Windows, version 5.0 on the following platform: NT
  • Microsoft Visual Basic Professional and Enterprise Editions, 16-bit and 32-bit, for Windows, version 4.0 on the following platform: NT

SYMPTOMS

The GeoFacts.vbp sample project fails with the following run-time error when run on a Windows NT machine:

   Run-time error '-2147467259 (80004005)':
   Automation error

This error does not occur on a Windows 95 machine.

CAUSE

The run-time error occurs on the following line of code:

   Set shtWorld = GetObject("world.xls")

The GetObject function fails because the full path to world.xls is not specified in the argument.

RESOLUTION

When using the GetObject function, make sure that the full path to the file name is specified. To correct the code in the GeoFacts.vbp sample, change the following line of code (located in the Setup procedure in Module1):

   Set shtWorld = GetObject("world.xls")

to:

   Set shtWorld = GetObject(app.path & "\world.xls")

STATUS

This behavior is by design.

REFERENCES

For additional information, please see the following articles in the Microsoft Knowledge Base:

   ARTICLE-ID: Q143461
   TITLE     : XL97: CreateObject and GetObject Work Differently

   ARTICLE-ID: Q178166
   TITLE     : PRB: GeoFacts Sample Causes Type Mismatch Error with
               Excel 97


Additional query words: 'world.xls' could not be found
Keywords : VB4ALL VB4WIN vb5all VBKBAutomation
Version : WINDOWS:4.0,5.0
Platform : NT WINDOWS
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: December 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.