Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Export to Excel, Date field problem
Message
 
 
À
23/02/2007 01:10:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
DB2
Divers
Thread ID:
01198209
Message ID:
01198258
Vues:
7
>Dear Experts
>
>Following procedure converts dbf into Excel.
>All fields exports to Excel except Date field.
>Date field in Excel sheet appears as
>23 oct 2007 instead of 23-10-2007 as in dbf.
>
>How to export Date fields according to dbf.
>
>Please help
>
>
>set safety off
>use ?
>als1=alias()
>if !empty(als1)
>	gcdelimname =alias() + '.xls'
>	gcdelimfile = putfile('excel_file:', gcdelimname, 'xls')
>	if !empty(gcdelimfile)
>		copy to (gcdelimfile) type xl5 && Create delimited file
>	endif
>
>	res=messagebox("Do you want to Open &gcDelimName",4+32+512,"Dbf2Xls")
>	if res=6
>		loexcel = createobject("Excel.Application")
>		loworkbook = loexcel.workbooks.open(gcdelimfile)
>		losheet = loworkbook.sheets(1) && or pass the name of your sheet as a string!
>		losheet.columns().autofit()
>		loexcel.visible = .t. && display Excel
>	endif
>endif
>
You may set date column NumberFormat to 'dd/mm/yyyy'

However, the question is - how do you figure out the type of the column? Perhaps you should write a loop through all columns.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform