Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 208512 - Last Review: June 30, 2004 - Revision: 2.0
ACC2000: Imported Excel Spreadsheet May Have Blank Columns
This article was previously published under Q208512
Novice: Requires knowledge of the user interface on single-user computers.
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).
When you import a Microsoft Excel spreadsheet whose cell table goes beyond
the last cell that actually contains data, you may get blank columns in the
Microsoft Access table. This behavior occurs with the TransferSpreadsheet macro and the
Import Menu commands.
When you use a TransferSpreadsheet macro action or the
TransferSpreadsheet method in Visual Basic for Applications to append data to an existing table from a spreadsheet file, you may receive an error message similar to the following:
Field 'F3' doesn't exist in destination table MyTable.
Microsoft Access was unable to append it.
The field specified in the error message may vary.
Excel keeps track of all the used cells on a worksheet by using an
activecell table. In some cases, the last cell of that table may refer to a cell outside of the area of the worksheet that is actually being used. When imported into Microsoft Access, all cells of the activecell table are imported; this may result in blank fields.
To avoid the extra columns when you import an Excel spreadsheet, use one of the following methods:
- Open the table in Design view and delete the extra columns.
- Use Excel to reset the last cell.For additional information about resetting the last cell, click the article number below
to view the article in the Microsoft Knowledge Base:
244435Â
(http://kbalertz.com/Feedback.aspx?kbNumber=244435/EN-US/
)
XL2000: Resetting the Last Cell Fixes Memory/Printing Problems
- Use the TransferSpreadsheet macro action and set the Range argument to the actual range of cells to be imported.
Steps to Reproduce Behavior
- Create a folder (directory) on drive C and name it Examples.
-
Start Microsoft Excel.
-
If a default blank workbook does not appear, on the File menu, click New, click Workbook, and then click OK.
- Type the following information in Sheet1:
A1: Sue B1: 10 C1: (enter a space in this cell)
A2: Tom B2: 20
A3: Jill B3: 30
A4: Tim B4: 40
- Save the workbook to the Examples folder as Test.xls, and then close it.
- Start Microsoft Access and open a new blank database.
- Create the following macro:
Action: TransferSpreadsheet
Action Arguments
----------------
Transfer Type: Import
Spreadsheet Type: Microsoft Excel 8-9 (or the corresponding version
on your system)
Table Name: New
File Name: C:\Examples\Test.xls
Has Field Names: No
- Save the macro as XLImport, and then close it.
- Run the XLImport macro.
- Open the New table.
Note that there are three fields (F1, F2, and F3), and that the third field is blank.
For more information about importing data from Microsoft Excel, click
Microsoft Access Help on the
Help menu, type
import or link data from a spreadsheet in the Office Assistant or the Answer Wizard, and then click
Search to view the topic.
For more information about the TransferSpreadsheet macro action, click
Microsoft Access Help on the
Help menu, type
transferspreadsheet action in the Office Assistant or the Answer Wizard, and then click
Search to view the topic.
APPLIES TO
- Microsoft Access 2000 Standard Edition
| kberrmsg kbinterop kbprb KB208512 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate