PRB: Zip-Code Format Changed If Imported from Microsoft Excel

Last reviewed: August 21, 1995
Article ID: Q135116
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a

SYMPTOMS

When importing a Microsoft Excel spreadsheet into FoxPro, you may see differences in the formatting of certain numbers. One example of this is when bringing over zip codes. A zip code may have a leading zero (0) in Microsoft Excel. The same zip code when imported into FoxPro will have a leading space. This is by design.

RESOLUTION

You can easily change this behavior. After the import is complete, if you see leading spaces where you want leading zeros. For example, assuming the field is named Zip and has a width of five, type the following command to update the table to show leading zeros instead of spaces:

   REPLACE ALL Zip WITH STRTRAN(Zip," ","0")

STATUS

This behavior is by design.


Additional reference words: FoxWin 2.50 2.50a 2.50b 2.60 2.60a
KBCategory: kbinterop kbprb
KBSubcategory: FxinteropExcel


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 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.