ACC: "Could Not Find Object" Error Importing MS Excel FileLast reviewed: August 29, 1997Article ID: Q162582 |
The information in this article applies to:
SYMPTOMSNovice: Requires knowledge of the user interface on single-user computers. When you try to import or link a Microsoft Excel spreadsheet, if you click Show Named Ranges in the Import Spreadsheet Wizard or the Link Spreadsheet Wizard, you may receive the following error message.
In Microsoft Access 97
The Microsoft Jet database engine could not find the object '<name of selected range>'. Make sure the object exists and that you spell its name and the path name correctly. In Microsoft Access 7.0
Couldn't find object '<name of selected range>'.You may also receive this error if you use a macro or a Visual Basic for Applications procedure to import or link the spreadsheet. NOTE: This error message has also been found to occur if a Microsoft Access 2.0 database is converted to Microsoft Access 7.0 or 97, and it includes a TransferSpreadsheet macro action or Access Basic code with a Range argument that contains the sheet name along with a named range. For example:
DoCmd.TransferSpreadsheet acExport, 8, "MyTable", "C:\MyFile.xls", True, "MySheet!MyRange" CAUSEThe named range you selected in the Import Spreadsheet Wizard or the Link Spreadsheet Wizard is longer than 64 characters. Although Microsoft Excel allows a name of up to 255 characters, the Microsoft Excel ISAM driver that Microsoft Access uses to import or link spreadsheets truncates a range name to 64 characters. The import or link fails because Microsoft Access cannot find the truncated range name in the spreadsheet. The reason for the 64-character truncation is that Microsoft Access uses the name of the range as the table name in your database, and table names are limited to 64 characters.
RESOLUTIONThere are two ways to work around this behavior.
Method 1Open the spreadsheet in Microsoft Excel and define a name for the range that contains 64 characters or fewer. You do not need to delete the existing longer name. Then, when you use the Import Spreadsheet Wizard or the Link Spreadsheet Wizard in Microsoft Access, select the shorter defined name.
Method 2Use the TransferSpreadsheet action in a macro or the TransferSpreadsheet method in a Visual Basic for Applications function to import or link a specific range in the spreadsheet. In the Range argument, specify the range by address rather than by name, for example "A1:E32." The following sample Visual Basic for Applications function demonstrates this method:
Function ImpByAddress() Docmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel97, _ "test", "c:\My Documents\Book1.xls", , "A1:E32" End Function MORE INFORMATION
Steps to Reproduce Behavior
REFERENCESFor more information about Microsoft Access table specifications, search the Access Help Index for "specifications, Microsoft Access." For more information about the TransferSpreadsheet method or action, search the Help Index for "TransferSpreadsheet method" or "TransferSpreadsheet action." For more information about range names in Microsoft Excel, search the Excel Help Index for "naming, ranges."
|
Additional query words: xl xls attach
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |