Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Over the past year I have found your site to be EXCELLENT. Never have I been able to find so many answers to such vast problems and it is an excellent service..."

Geography

Where in the world do Tek-Tips members come from?
Paco75 (Programmer)
28 Jun 12 14:32
Hi,

I want to import data from excel file into a vfp table. I tried with IMPORT command but it does not work...

here is the code i use:

CODE -->

MyFile = GETFILE("Excel *.xls:XLS","Import the excel file:","Import",0,"Choose the file to import")
IF NOT EMPTY(MyFile) THEN 
	IMPORT FROM JUSTFNAME(MyFile) TYPE XL8  && imports the XLS into a DBF
ENDIF 
Note: for the tests the excel file is in the application root folder.

At first i received the following error message:

"Microsoft Excel file format is invalid."

I tought i was probably because the excel was in excel 2007 and this format is not supported by vfp... then i saved it in excel 97-2003 format. Now it seems to be working for 10 seconds and then it gives me this message:

"Microsoft Visual FoxPro 9.0 SP2 has stopped working
A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is availiable."

Im out of ideas... any clue?
Helpful Member!  MikeLewis (Programmer)
28 Jun 12 15:05
You were right. It is because you are using Excel 2007. But saving it to 97-2003 format won't solve it. You need to save it to either Excel 5.0/95 or CSV. Either way, you risk losing any formatting or other features that are specific to 97 or later.

There are several other ways of getting data out of Excel 2007 and into VFP, but I suggest you try the above first, as it is the simplest solution.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy

johann59 (Programmer)
28 Jun 12 15:21
One small tip. If original Excel 2007 contains more than 65,536 records, better to save to a .csv file, otherwise you'll truncate the remaining records.

Johann
Paco75 (Programmer)
28 Jun 12 15:35
thanks it worked in Excel 5.0/95

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close