Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help converting multiple sheets to VFP

Status
Not open for further replies.

Menglish

Programmer
Jun 22, 2001
66
I have a company that has been keep their records in Excel and want everything converted to Visual foxPro. They have an entry for each day, file:Jan. 31 entries,File Feb. 28 entries, etc.

Is there a way I can convert these without having to do one sheet at a time. I have very little experience in converting formats. ("import from xxx type XLS" only gets one sheet.)

Thanks for any help.

Millard
 
Menglish

If the "parameters" are constant you could use OLE automation to accomplish the process.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike,
I haven't checked 365 X 3 years yet but they appear to be the same page with numbers changed daily and a month per file. There are 39 rows.

I have absolutely no experience in OLE automation. Can you advise or steer towards a link that covers the process?

Thanks for the help.

Millard
 
Menglish

Excel Automation is no more difficult then learning VFP, except that most of the help out there in mostly VB code, wich needs to be translated. You may want to start by looking at the "solutions" (available with VFP), there 3 or 4 samples of OLE automation of Excel with VFP. After that to get certain pieces of code missing, you may do a search in this forum (Using the Keyword search). Although learn the solution might take you as long as importing them. In order to import different sheets from Excel you have to use the XL5 format
IMPORT FROM C:\BOOK1.XLS TYPE XL5 SHEET "SHEET1"
OR
IMPORT FROM C:\BOOK1.XLS TYPE XL8 SHEET "SHEET1"

And loop through your sheets numbers. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
MENGLISH

A word of caution about IMPORTing different sheets is it will overwrite the last sheet copied, it does not append. MNy suggestion would be to make a table per sheet and combine the tables after.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thanks Mike. I really didn't want to have to run this 365 times...but I guess that goes with the territory.

Thanks for the advice.

Millard
 
I guess I am not as nice as you guys. When I hit something like this, I make them have one of their people spend a few hours cutting and pasting everything into one (or at last as few as possible) spreadsheet(s). Once you explain it is a one time job, not really programming and it will be a lot less expensive for them to do it than to pay you to do it. The usually come right around.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top