Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Converting Xslx to Xls
Message
 
À
27/10/2016 11:01:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01642393
Message ID:
01642397
Vues:
43
>>>>I am converting xslx to xls
>>>>
>>>>This is my code
>>>>
>>>>oXL = CreateObject("Excel.Application")
>>>>oXL.Workbooks.Open("c:\citisprint\attachxls\latest.xlsx")
>>>>oXL.ActiveWorkbook.Saveas("c:\citisprint\attachxls\latest.xls", 39)
>>>>
>>>>Conversion works fine except that the date in the xslsx file of 24/10/16 gets converted to 42667 in the xls file
>>>>
>>>>Any ideas
>>>>
>>>>Colin
>>>
>>>In Excel, {^2016-10-24} is just the representation, as a date, of the number 42667. Dates are numbers, as offsets from {^1899-12-30}. That is, if you add {^1899-12-30} to the number in the cell, you'll get the date displayed when the cell is formatted as a date.
>>
>>
>>Sorry I dont understand how to do that
>>
>>
>>oXL = CreateObject("Excel.Application")
>>oXL.Workbooks.Open("c:\citisprint\attachxls\latest.xlsx")
>>oXL.ActiveWorkbook.Saveas("c:\citisprint\attachxls\latest.xls", 39)
>>
>>How do I do that to column h in the active workbook lates.xls - what is the code I need to use
>>
>>Thanks
>>
>>Colin
>
>I don't know if you can do that with with Excel automation, but if you are importing latest.xls into VFP, that is, as a table, just recreate the column value as a date.
>
>
>ALTER TABLE latest RENAME COLUMN h TO hn
>ALTER TABLE latest ADD COLUMN h D
>UPDATE latest SET h = hn + {^1899-12-30}
>ALTER TABLE latest DROP COLUMN hn
>
My code is now ALTER TABLE latest RENAME COLUMN h TO hn
ALTER TABLE latest ADD COLUMN h D
UPDATE latest SET h = hn + {^1899-12-30}
ALTER TABLE latest DROP COLUMN hn
cancel
Specialist in Advertising, Marketing, especially Direct Marketing

I run courses in Business Management and Marketing
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform