Andrew Douglas Pitonyak <andrew <at> pitonyak.org> writes: > Can you email me a Calc document with the macro that demonstrates the > problem? For example, create a document that has a value in one cell > that is not properly returned by getValue(). Can you then write the > simple macro that fails to return the small value? > > I created a sheet that has the value "0.00001" in cell A1 on the first > sheet. I then used the following macro: ... > Print d > Print Format(d, "0.#######") > End Sub > > The first print statement prints 1e-05. The second print statement > prints "0.00001". The cell itself shows the value "0" unless I place the > cursor into the cell or change the number format associated with the cell. > Thanks. For what it's worth, I'll send the document. I did not know about "Print Format(...)" The sheet I prepared to send you contains 0.075 in A1. The cell was formatted for "0.000" and correctly showed the value "0.075". My macro, pretty well the same as yours, returned "7.5E-02" for the first print command. The next (to me, new) command Print Format(dValue, "0.###") returned "0.075". That's more than I've achieved previously but there may still be a problem when you try to do anything with the value other than print or include it in a message. As an example I tried, hastily, to write a macro to set the value of B1 by reference to the value obtained from A1, thus: Dim dValue as Double, oCell as Object, oDoc as Object, oSelect as Object, _ oSheet as Object, tCellAddress, tRangeAddress
oDoc = ThisComponent oSelect = oDoc.CurrentSelection oSheet = oDoc.Sheets.getByIndex ( 0 ) dValue = oSelect.getValue ' Print dValue - got me 75E-02 ' Print Format(dValue, "0.###") - this worked oCell = oSheet.getCellbyPosition ( 1, 0 ) oCell.NumberFormat = 107 oCell.setValue ( dValue ) ' oCell.setValue ( Format (dValue, "0.###") ) tried and failed End Sub The number format 107 is "0.000". The macro resulted in the value 0.000 in cell B1. Perhaps it is necessary to create a new number format each time you want to enter or otherwise manipulate a value, but at the time I was writing my (real) macros, it was a darn sight easier to use getString. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]