I solved it this way. First COPY TO myFile XLS and then open myFile using VBA (oExcel) and select your way through the columns and insert the format.
With oExcel
.WorkBooks.WorkSheet.Open("myFile")
.Columns("Q:Q").Select
.Selection.ColumnWidth=8
.Selection.NumberFormat="0.000000"
endwith
>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
Imagination is more important than knowledge