Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem populating a VFP table with an Excel 'date' fiel
Message
 
To
03/03/2000 13:13:26
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00340955
Message ID:
00341411
Views:
20
I am using Excel 2000 and VFP 6 SP3. I have ended up making the field a text field in Excel and checking/correcting the format and converting to date before populating the table in FoxPro. This should work in most cases...

But I would really like to make it right. If anybody has the answer please let me know!

Thanks for your help

>I'm not sure. Date1904 is a boolean property of a Workbook object. The example in the Excel 2000 Language Reference is "ActiveBook.Date1904 = True". If you are using an earlier version of Excel,perhaps that property doesn't exist. If not, then skip that part and try one of the two date calcs. I believe the default is 01-01-1901+Serialno. Try it.

>> Thats the serialize data value. First off, you have to figure out which date > system is being used, then convert:
>
>> WITH oExcel.ActiveBook
>> IF .Date1904
>> dDate={^1904-01-02}+VAL(.ActiveCell.FormulaR1C1)
>> ELSE
>> dDate={^1901-01-01}+VAL(.ActiveCell.FormulaR1C1)
>> ENDIF
>
>Thanks for the help, I'm sure that the answer is near but I'm still having problems. Here is my code:
>
>oExcel= CREATEOBJECT("Excel.Application")
>WITH oExcel
>.DisplayAlerts= False
>.workbooks.open(thisform.FileName)
>.Range("C6").Select
>
>If I use this code:
>IF .Date1904
>I get "OLE error code 0x80020006: Unknown name."
>
>If I use this code:
>IF .ActiveBook.Date1904
>I get "Member ACTIVEBOOK does not evaluate to an object."
>
>If I use this code:
>IF .WorkBook.Date1904
>I get "Member WORKBOOK does not evaluate to an object."
>
>Am I possibly missing something in my header file?
>
>Thanks
Larry Collins
TheProgrammerGuy.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform