Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot sort by date when data export to Excel
Message
From
22/10/2012 06:18:50
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Cannot sort by date when data export to Excel
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01555430
Message ID:
01555430
Views:
60
Hi,

I find that when I export some data to a Excel file which have the date field
in the first column, it cannot be sorted by the date field it in Excel.

Why ?

My code as following
use invoice
SELECT invoice
EXPORT TO invenq.xls TYPE XLS FIELDS delidate, invno, stock
oExcel = CREATEOBJECT([Excel.Application])
oWorkbook = oExcel.Workbooks.open("C:\WTS\MID\INVENQ.XLS")
oExcel.Visible = .t.
lnLastRow = oExcel.activesheet.UsedRange.Rows.Count
lnLastCol = oExcel.activesheet.UsedRange.Columns.Count
oExcel.activesheet.Range("A2:A"+TRIM(PADR(lnLastRow,11))).NumberFormat ='dd/mm/yyyy'
where the delidate is a date type field.

But If I manually create a new worksheet and I key in the date field,
then it can be sorted.

Why ? Please advise.
Thanks.
Derek
Reply
Map
View

Click here to load this message in the networking platform