>Found the problem. To me, it's a VFP bug, but it might be by design.
>
>When using OLE automation to fill a spreadsheet, if the variable is typed "Currency" VFP rounds to 2 decimal places before sending to Excel. You can't even fool VFP by reading the value into memory and then sending to Excel because VFP keeps the variable typed as currency.
>
>If you create a temp sql cursor from a table with currency values, the values in the temp cursor are typed as currency. I had to define some variables as numeric (99.9999 AS yPremium) and created another variable as currency (yPremium AS premium) used the READWRITE keyword to make a cursor I could write to and scanned the cursor replacing the yPreimum with Premium. Then when I used the yPremium variable in the statement it was typed as numeric.
>
>I guess I could have changed the value like this:
>
>lnValue = VAL(STR(yPremium,7,4)) to change it also, but thought of it later.
>
>So if you need to export more than 2 decimals to Excel make sure you don't store them as currency.
You can convert to numeric with mton(), before converting to Excel.
HTH, Hilmar.
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)