Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date sorting in Excel after export
Message
From
09/05/2002 16:50:41
Rene Van Den Berg
Infertility Database Systems Ltd
Islington, United Kingdom
 
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00653969
Message ID:
00654745
Views:
23
Hi David,

Thanks for that. In the end I used Alex Feldstein's code to get the data in the right format and that works a treat.

USE MyTable
lcDBF = "c:\temp\MyDBF.dbf"
lcXLS = "c:\temp\MyXLS.xls"
COPY TO (lcDBF) TYPE FOX2X
loExcel = CREATEOBJECT("Excel.Application")
WITH loExcel.Application
.Workbooks.Open(lcDBF)
.ActiveWorkbook.SaveAs(lcXLS, -4143, "", "", .F., .F.)
.Workbooks.Close
ENDWITH
RELEASE loExcel

Thanks for your help.

Rene.

>Rene,
>
>Is the cursor small enough that you use OLE automation of Excel to populate the spreadsheet? It would take longer to run but you'll get the right result.
>
>I think you could also automate Excel to open the DBF and SaveAs XLS.
>
>>I'm doing a "copy to myfile type xls" command from VFP 6. There is a date field in my source file (a cursor in this case). In Excel (Excel 97) the resulting field is not formatted as a date field, but as a text field. Changing it in Excel (using the Format field command) works fine, but sorting on the field sorts it 01/02/67, 01/03/52, 01/04/87, etc.
>>
>>Any idea if there is a workaround for this? I've tried changing the date within VFP to a different format (such as SET DATE ANSI, result = 1967.02.01), but this makes no difference.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform