PRB: Opening Excel 4.0 Worksheets with DAO

Last reviewed: August 6, 1997
Article ID: Q172404
The information in this article applies to:
  • Microsoft Visual Basic Control Creation, Learning, Professional, and Enterprise Editions for Windows, version 5.0 on the following platforms: NT, Win95

SYMPTOMS

Opening an entire Excel 4.0 Worksheet, according to the syntax described in Books Online and according to the syntax used in all previous versions of Visual Basic, will cause Run-time error '3011'.

RESOLUTION

For a workaround, modify the Source argument for the OpenRecordset method from FILENAME#XLS to FILENAME$. Please see below for an illustration.

   Set db = OpenDatabase("c:\file.xls", False, False, "Excel 4.0;HDR=NO;")
   Set rs = db.OpenRecordset("file$")

STATUS

Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The syntax specified in Books Online for working with Excel Worksheets and Workbooks is consistent with the documentation for all previous versions of Visual Basic.

Other than opening entire Excel 4.0 Worksheets, no other problems are known to exist at this time. In fact, opening a named range in an Excel 4.0 Worksheet will work just as described.

Keywords          : VBKBDAO VBKBDB VBKBJet VBKBObj VBKBDAODatabase VBKBRecordset VBKBBooksOnline
Component         : dao
Version           : WINDOWS:5.0


================================================================================


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: August 6, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.