Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date format of the excel cell
Message
De
17/07/2014 23:33:10
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Date format of the excel cell
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP3
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01603996
Message ID:
01603996
Vues:
56
Hi,

I have the following code to export the Invoice no.and invoice date to the excel file,
I find that if the invoice date field in the invoice.dbf is blank or ' / / ',
the output format of excel is always in this format: " - - ",
even though I set the cell to 'dd/mm/yyyy'

I want the cell become blank if the invoice date is ' / / '.
Please advise how to do it.
USE INVOICE IN 0 ALIAS invoice
set index to invoice
EXPORT TO invoice.xls TYPE XL5 FIELDS invoice->invno, invoice->date
USE
oExcel = CREATEOBJECT([Excel.Application])
oWorkbook = oExcel.Workbooks.open("C:\WTS\MID\WTS77XLS.XLS")
oExcel.Visible = .t.
WITH oExcel.activesheet
         .Range("A1").value = "Invoice No."
         .Range("B1").value = "Invoice Date"
         lnLastRow = .UsedRange.Rows.Count
         lnLastCol =.UsedRange.Columns.Count
         .Range("A2:"+"A"+TRIM(PADR(lnLastRow+1,11))).NumberFormat ='dd/mm/yyyy;;' 
ENDWITH
Derek Yim
Répondre
Fil
Voir

Click here to load this message in the networking platform