Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hex values converted to exponents during Excel Automatio
Message
From
27/01/2004 20:16:29
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
27/01/2004 19:08:53
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00871210
Message ID:
00871228
Views:
13
>I have the need to send data to an Excel spreadsheet. I'm using automation to write the values out to the spreadsheet but one of the rows of data is a four digit hexadecimal number which is sometimes interpreted by Excel as a exponential expression.
>
>I've tried to find a way to Excel to format that column/range of cells as text but either the answer is hidden well or the lack of sleep has caused me to miss the answer in the Excel help file and Office Automation with Visual Foxpro book by Tamar Granor and Della Martin.
>
>The current, mostly working bit of code...
>
>
>      .Columns[1].value  = lnPartCnt
>      .Columns[2].NumberFormat = '00##'
>      .Columns[2].value  = CastHist.SerialNo
>      .Columns[3].value  = CastHist.MastHeat
>
>
>Examples of the hex data that is converted...
>2E63
>30E8
>30E7

The "E" is interpreted as "exponent", as you are probably aware.

If you want to have Excel accept this as text, you can use Cell.Value = ['] + "2E63", for instance. That is, start with a single quotation.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform