Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting Xslx to Xls
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01642393
Message ID:
01642398
Views:
35
>>>>>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


Sorry I sent the last post too early - it errors on the update line with operator / operand type mismatch
Specialist in Advertising, Marketing, especially Direct Marketing

I run courses in Business Management and Marketing
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform