Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel VBA date format problem (revised)
Message
De
09/06/2014 11:11:46
 
 
À
09/06/2014 03:02:46
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01601468
Message ID:
01601495
Vues:
40
>Hi
>I want to export the invoice no and invoice date to the Excel worksheet,
>I set the date to british, the date format is dd-mmm-yyyy,
>the record of the invoice date format in the invoice.dbf is store in mm/dd/yy,
>I find that if the invoice date in invoice file is 5/24/14, the output of the cell is in 24-May-2014, it is dd-mmm-yyyy correct format ,
>but if the invoice date in invoice file is 5/7/14, the output of the cell is still is 05-Jul-2014, I think it should be 07-May-2014.(dd-mm-yyyy)
>why it change ?
>Please advise.
>
>SET DATE BRITISH
>oExcel = CREATEOBJECT([Excel.Application])
>oExcel.SheetsInNewWorkbook = 4
>oWorkbook = oExcel.Workbooks.Add()
>nrow=2
>select invoice
>do while !eof()
>    with oExcel.activesheet
>         .Range("A"+TRIM(PADR(nrow,11))).value="'"+dtoc(invoice->invno)
>         .Range("B"+TRIM(PADR(nrow,11))).NumberFormatLocal ="dd-mmm-yyyy"	    
>         .Range("B"+TRIM(PADR(nrow,11))).value=dtoc(invoice->invdate)
>   endwith 
>   nrow = nrow + 1
>   select invoice
>   skip 1
>enddo
>
>Thanks.
>Derek

Try it without DTOC()
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform