Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel Format Cell problem
Message
From
10/06/2011 04:00:52
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Excel Format Cell problem
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01513977
Message ID:
01513977
Views:
95
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.
Next
Reply
Map
View

Click here to load this message in the networking platform