Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel Format Cell problem
Message
De
10/06/2011 04:00:52
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:
Excel Format Cell problem
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01513977
Message ID:
01513977
Vues:
96
Hi
how to display leading zero char. in Excel Cell

I have a invoice field contain a invoice no. 10 char. "000234567"
I set it to the Excel worksheet by following code.
oExcel = CREATEOBJECT([Excel.Application])
oExcel.SheetsInNewWorkbook = 4
oWorkbook = oExcel.Workbooks.Add()
oExcel.Visible = .t.
oExcel.activesheet.Range("B"+TRIM(PADR(nrow,11))).Font.Size = 10				
oExcel.activesheet.Range("B"+TRIM(PADR(nrow,11))).HorizontalAlignment = xlHAlignLeft
oExcel.activesheet.Range("B"+TRIM(PADR(nrow,11))).value = rpt012->invno
But it show out the numeric format value 234567,
I want the value is in Text Format => "000234567"

I try this,
oExcel.activesheet.Range("B"+TRIM(PADR(nrow,11))).NumberFormat = [0000000000]
The cell can dispay 000234567, but the cell is still in numeric format.

How to set the cell to a text format and can display leading zero ?
Please advise,

Thanks.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform