Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to format a range of cell with numbers as text
Message
From
26/05/2008 15:05:54
Peter Wagner
Point Informática Ltda.
Limeira, Brazil
 
 
To
26/05/2008 14:20:38
Peter Wagner
Point Informática Ltda.
Limeira, Brazil
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01319538
Message ID:
01319548
Views:
23
I found the solution
oExcel.ActiveSheet.Range("C14").NumberFormat = "@"
>Hi!
>A friend asked me how to format some cell's as text.
>
>He needs to store some cells with some values that can be numeric, alplanumeric ou text like: "0345", "34e12" or "a345"

>The main problem is that another software his client has will read those values and it only understand those value as text, so it's not allowed to use a apostrophe in front of any value, because it would change the value for the other software.
>
>I tried to format the cell in a test
>
>oExcel = CreateObject("Excel.Application")
>oExcel.Visible = .T.
>oBook = oExcel.Workbooks.Add()
>oExcel.ActiveSheet.Range("C14").NumberFormat = "00000000000000"
>oExcel.ActiveSheet.Range("C14").Value = "05041910505374"
>oExcel.ActiveSheet.Range("C15").NumberFormat = "00000000000000"
>oExcel.ActiveSheet.Range("C15").Value = "05044"
>
>
>In this case the propertie NumberFormat doesnt work
>Is there another solution form this problem.
>
>Any Ideas?
>
>TIA
>
>Peter
Previous
Reply
Map
View

Click here to load this message in the networking platform