How to convert Excel file into foxpro .DBF file?

y-lee
y-lee used Ask the Experts™
on
help me.. i got foxpro file, and i wanna convert it into foxpro dbf. how can i do that?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
going by your subject, I presume you want to convert xls to dbf. Open the XLS in excel and 'save as' DBF.

kannan

Commented:
To do this from within VFP you could use the import wizard.  It imports excel pretty well, I do it every week.
or just save it from Excel as a CSV, and append it into a table with the structure you need, csv.
John
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

Author

Commented:
yeah u are rite, but i need to change in programmatically in vfp code, but that ok. thanx anyway

Commented:
Hey, y-lee.

You would have got a better answer if you said that you want to change "programmatically".  You did not need to select answer so quickly.

#Sample Code
<------------ Sample Test Code #1 Begins ------------->
create cursor imported_data ( ;
  a C(40), b C(40), c C(40), d C(40), e C(40), ;
  f C(40), g C(40), h C(40), i C(40), j C(60) ;
  )
select imported_data
append FROM (cFileName) TYPE XL8
<------------ Sample Test Code #1 Ends ------------->

<------------ Sample Test Code #2 Begins ------------->
import from (cFileName) type xl8
<------------ Sample Test Code #2 Ends ------------->

Bye. -e2

Commented:
.. or do this if you don't know the number of columns involved and the conversion to be done by excel..this should work in most version of excel.

#DEFINE xlDB4 11
xlObject = CREATEOBJECT("", "Excel.Application")
xlObject.WorkBooks.Open(<XlsFile>)
xlObject.ActiveWorkbook.SaveAs(xlsname, xlDB4)
xlObject.Quit

kannan

Commented:
Another excellent suggestion by komandur.  -e2

Commented:
.... and have been awarded 'C' for this <g>

Commented:
I am glad that we can't get F's.  If those could be given I am sure they would be!!!  Since a C is double the points, I would guess a D would be single points and an F would give the questioner that number of points.  That sounds like a good idea.  I post a 300 point question, you give an excellent answer, I give an F and get point along with the excellent answer.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial