Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Exporting To Excel
Message
From
19/05/2005 12:21:43
 
 
To
19/05/2005 10:18:45
Stan Vaninger
Mitek Industries, Inc
Missouri, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Network:
Windows NT
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01015815
Message ID:
01015864
Views:
35
Can you step through the table and copy each record? Something like:
SET SAFETY OFF
CREATE TABLE foxtest (ca c(10), cb c(10), cc c(10))
PRIVATE icounter
FOR icounter = 1 TO 1000
    sele foxtest
    APPEND BLANK
    REPLACE ca WITH "a" + ALLTRIM(STR(icounter))
    REPLACE cb WITH "b" + ALLTRIM(STR(icounter))
    REPLACE cc WITH "c" + alltrim(STR(icounter))
    icounter = icounter + 1
ENDFOR

RELEASE oExcel
lcXLSFile = 'foxtest'
lcXLSFile = ForceExt(lcXLSFile, "XLS")

lcRange = "a1:c1000"
oExcel = CREATEOBJECT("excel.application")
WITH oExcel
   .WorkBooks.add()
   WITH .ActiveWorkbook.ActiveSheet.RANGE(lcRange)
     FOR ix = 1 TO RECCOUNT('foxtest')
         GOTO ix
         .cells(ix,1) = foxtest.ca
         .cells(ix,2) = foxtest.cb
         .cells(ix,3) = foxtest.cc 
     ENDFOR
   ENDWITH
   .save(lcXLSFile)
ENDWITH

USE IN foxtest
oExcel.quit()
>I am using Office 2000.
>
>Export To (lcPathFile) Type XlS
>When I do an export to Excel with type XLS (as shown above) and then open the spreadsheet with excel and save it, I get a dialog that says, "MyFile.xls is a Microsoft Excel 2.1 Worksheet. Do you want to overwrite it with the latest Excel format?"
>
>Export To (lcPathFile) Type Xl5
>When I do an export to Excel with type XL5 and then open the spreadsheet with excel and save it, I get a dialog that says, "MyFile.xl5 is a Microsoft Excel 5.0/95 Workbook. Do you want to overwrite it with the latest Excel format?"
>
>But the XLS and XL5 file types are the only two Excel types in the VFP9 Help file. Both types seem to produce what sounds like ancient formats. Is there a undocumented type that produces an Excel spreadsheet that Office 2000 likes?
>
>Thanks,
>Stan
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform