XL7: Illegal Operation Using OpenDatabase with Open Database

ID: Q133199


The information in this article applies to:
  • Microsoft Excel for Windows 95, version 7.0


SYMPTOMS

In Microsoft Excel, when you run a macro that uses the OpenDatabase method to open a database and return a reference to a database object that is currently open in Microsoft Excel, you receive an Illegal Operation error in Microsoft Excel. If you click Details, a message similar to the following appears:

EXCEL caused an invalid page fault in module VBA32.DLL at 0137:00b3b392.


CAUSE

This problem occurs when the existing database file that you open using the OpenDatabase method is open in Microsoft Excel. For example, when you run the following macro, you receive an Illegal Operation error in Microsoft Excel if Book1.xls is currently open:


   Sub Test()
     Dim MyData as Database
     Set MyData = OpenDatabase("Book1.xls", _
      False, False, "Excel 5.0")
   End Sub 
Note that this problem occurs regardless of whether the database file is open in the current session of Microsoft Excel or in another session of Microsoft Excel.

Note that you may receive the following error message instead of the Illegal Operation error message when you run this macro or when you step through this macro:
Run-time error '28':

Out of stack space


RESOLUTION

To avoid this problem, make sure that the database file that you want to open using the OpenDatabase method is not open in the current session of Microsoft Excel.


STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


REFERENCES

For more information about using the Microsoft DAO 3.0 Object Library, click the Index tab in Microsoft Excel Help, type the following text

DAO Overview
and then double-click the selected text to go to the "Data Access Objects Overview" topic.

Additional query words:

Keywords : kbprg xlwin
Version : WINDOWS:7.0
Platform : WINDOWS
Issue type :


Last Reviewed: October 14, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.