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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export data to Excel .txt or .frx 1

Status
Not open for further replies.

shangrilla

Programmer
Nov 21, 2001
360
US
Hi:

I need to convert an existing report to Excel? If anybody has any experience with this, please let me know how should I go about it.

Which one following would be the best.

- Convert the .txt file (prepared from foxpro report) to Excel.
- Send data directly to Excel from Foxpro tables.

Thanks
 
If you want to export your table then you can use COPY TO command.

Or refer to thread184-517219

See if this helps. :)
 
Solution #1

Look like three steps to me.

Solution #2

Only two steps.

Take you table and use the COPY TO command. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
there are number of ways to see the report in excel format
firstly create a object
Code:
oExcel=createobject("Excel.Application")
with oExcel
WITH MyExcelObj
  .Workbooks.Add				
  .Sheets(1).Select
  SELECT curFinal
  GO top
  SCAN WHILE NOT EOF("CURFINAL")
    .Cells(lnRownum,2).value=curfinal->fieldname1
    .Cells(lnRownum,3).value=curfinal->fieldname2
    ........
  endscan
  .visible=.T.
endwith
oExcel=.NULL.
release oExcel
 
Thanks guys. I think this should do it. If I ever get stuck again I know where to come back.
 
Shangrilla,

The one issue I had with export to excel was the record limit of 16383 records. I overcame this by exporting to file type CSV using the following in my program.


store [filename] to mfile
use &mfile excl
go bott
store recno() to mnum

if mnum < 16383
copy to &mfile type xl5
else
copy to &mfile type csv
endif

John
 
Export data to Excel AND FORMAT THE columns

i have used the code to convert to excel as follows

i want to format the exported excel columns
please help

oExcel=createobject(&quot;Excel.Application&quot;)
with oExcel
WITH MyExcelObj
.Workbooks.Add
.Sheets(1).Select
SELECT curFinal
GO top
SCAN WHILE NOT EOF(&quot;CURFINAL&quot;)
.Cells(lnRownum,2).value=curfinal-&gt;fieldname1
.Cells(lnRownum,3).value=curfinal-&gt;fieldname2
........
endscan
.visible=.T.
endwith
oExcel=.NULL.
release oExcel

 
I have to put in a vote for my FAQs on passing tables to Excel via HTML. The two FAQs below can easily be combined to form excellent formatted Excel reports from tables in a fraction of the time automation takes.

Brian

faq184-4704 Export a Formatted Table to Excel using HTML

faq184-3005 Export (groups of) DBFs to Excel Workbook QUICKLY
 
Shangrilla

Here is an example using automation (VFP to Talk to Excel).

faq184-4428 Excel - How to do Automation from VFP

Automation is nice if you don't have a ton of data. It is slower, but offers you more control.



Jim Osieczonek
Delta Business Group, LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top