Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Importing Date field back from Excel
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Database:
Visual FoxPro
Divers
Thread ID:
01097500
Message ID:
01097670
Vues:
11
This message has been marked as the solution to the initial question of the thread.
>Yuri
>See my answer to Sergey ( i used by mistake XLS instead of XL5 in the export ).
>To answer your question in the other message, i am using of course the Value property of the cells to bring back the results. I broke my replace in many replace clauses ( one for each field ) and that's how i found the dates were causing the mismatch in the first place.
>Now the puzzling thing remains the empty dates: in the debugger, vartype(.Cells(x,y).Value ) is T for the date fields but C if the date is empty!!
>

CAST() minced every string garbage and it maintains date and datetime
CAST(.Cells(x,y).Value AS D)
>Jaime
>
>>>Ok i see what's happening now.
>>>When i export to excel, the date fields get formatted as in the default for excel, in my case in format "Mar 8, 2006". I tried running .Range('S:S').NumberFormat='dd-mm-yyyy' for the date fields, but then i just saw in the debugger they come as "08-Mar-2006", so the CTOD on this fails ( it just gives me empty dates now ).
>>>
>>>Jaime
>>>
>>
>>Sorry, but it is very strange. Formatting means how the information is presented/displayed, still its VALUE should remain as is (if you/user do not touch it).
>>
>>?OExcel.Activesheet.Cells(2,1).value && time datatype, 03/08/2006 ....
>>?OExcel.Activesheet.Cells(2,1).text && TEXT datatype, "08-Mar-2006"
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform