Article ID: 954318 - Last Review: June 11, 2008 - Revision: 1.2

Microsoft Visual FoxPro fails to import Microsoft Excel 2007 Workbook saved in "Excel 97-2003 Workbook" format

Expand all | Collapse all
Source: Microsoft Support

RAPID PUBLISHING

RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.

Action

You are using the IMPORT FROM command in Microsoft Visual FoxPro 8 or 9 to import a Microsoft Excel workbook that was saved in "Excel 97-2003 Workbook" format using Microsoft Excel 2007.

Result



If you are running Microsoft Visual FoxPro 8 or 9 on a Windows XP or earlier operating system, you see the message:

      File format is invalid.

If you are running Microsoft Visual FoxPro 8 or 9 on Microsoft Windows Vista, Microsoft Windows Server 2003, or Microsoft Windows Server 2008, you see an error stating:

      Microsoft Visual FoxPro <version number> has stopped working
      A problem caused the program to stop working correctly.
      Windows will close the program and notify you if a solution is available.

Pressing the Close program button clears the dialog. Under some circumstances, you may then see a C0000005 error.

Cause



The "Excel 97-2003 Workbook" format workbook created by Microsoft Excel 2007 contains additional content that does not exist in Microsoft Excel 2003 when you save a workbook in "Microsoft Excel 97-Excel 2003 & 5.0/95 Workbook (*.xls)" format. Despite being listed as Excel 97 and 2003 compatible only, the Excel 2007 version contains extra information, such a round trip records, to make the file compatible with features found in Excel 2007. As such, Visual FoxPro does not understand and cannot import that file format.

Resolution



There are several possible solutions to this problem.
  1. Save the workbook in "Microsoft Excel 97-Excel 2003 & 5.0/95 Workbook (*.xls)" format using Excel 2003.
  2. Save the workbook in "Microsoft Excel 5.0/95 Workbook (*.xls)" format using Excel 2007.
  3. Use OLE automation to read the data from the Excel 2007 spreadsheet and write it to a VFP table.
  4. Use the "Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb) ODBC driver" included with the "2007 Office System Driver: Data Connectivity Components" package to access and extract data from the Excel workbook, either through a VFP Remote View or programmatically. The following article describes how to do this: Importing data from a Microsoft Excel 2007 workbook using Visual FoxPro 9.0 (http://support.microsoft.com/default.aspx?scid=kb;en-us;949529)


Note: Option 4 assumes you save the file in Excel 2007 format (XLSX) and not the earlier Excel 2003 format.

For more information on Excel 2007 file formats, please see this article: Microsoft Office Binary (doc, xls, ppt) File Formats (http://www.microsoft.com/interop/docs/officebinaryformats.mspx)

DISCLAIMER

MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, RELIABILITY OR ACCURACY OF THE INFORMATION CONTAINED IN THE DOCUMENTS AND RELATED GRAPHICS PUBLISHED ON THIS WEBSITE (THE “MATERIALS”) FOR ANY PURPOSE. THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE.

TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.

APPLIES TO
  • Microsoft Visual FoxPro 8.0 Professional Edition
  • Microsoft Visual FoxPro 9.0 Professional Edition
Keywords: 
kbnomt kbrapidpub KB954318