Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Losing decimals when filling spreadsheet
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Losing decimals when filling spreadsheet
Miscellaneous
Thread ID:
00664829
Message ID:
00664829
Views:
62
I have a program that builds an Excel worksheet with numberic values with 4 decimal places. Some of the values are losing decimals and being rounded to 2 places. I have the following code:

.RANGE("F"+ALLTRIM(STR(lnRow))).VALUE = yfreight
.RANGE("G"+ALLTRIM(STR(lnRow))).VALUE = ydiscount
.RANGE("H"+ALLTRIM(STR(lnRow))).VALUE = ydelivered

Fields in the table:
yfreight = 0.0275
ydiscount = 0.0012
ydelivered = 1.2436

Transfered to Excel
F(x) = 0.03
G(x) = 0.00
H(x) = 1.2436

I have tried to use a template with preformated columns. No luck.
I have tried to use the following:
.RANGE("F"+ALLTRIM(STR(lnRow))).NumberFormat = "##.####"
No luck.

I then traced the statements in Debug and yfreight was 0.0275 before and after the statement was executed but the value in Excel was 0.03 (holding your cursor over the .RANGE display's the value Excel received)

ydelivered was the only numeric value transfered correctly.

Has anyone had this problem?

Any ideas?

Thanks

Don Tanner
Don Tanner
Next
Reply
Map
View

Click here to load this message in the networking platform