Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel VBA Date format problem
Message
From
09/06/2014 03:00:07
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Excel VBA Date format problem
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP3
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01601467
Message ID:
01601467
Views:
45
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 ='General' 	    
         .Range("B"+TRIM(PADR(nrow,11))).value=dtoc(invoice->invdate)
   endwith 
   nrow = nrow + 1
   select invoice
   skip 1
enddo
Thanks.
Derek
Next
Reply
Map
View

Click here to load this message in the networking platform