Terry North wrote:
David Chapman <richhillsoftware <at> gmail.com> writes:
There are three ways of grabbing cell information.... summarized with examples
here..
http://www.openofficetips.com/blog/archives/2004/11/macros_getting.html
... All I need to do is get the value dumped to a string so that I can compare
it. ... RK
The value obtained can be converted to a string with cStr (...). I have been
unable to get Basic to read values of less than 1, so I have "cheated" by using
.String or .getString rather than .Value or .getValue. I have an idea you're
not supposed to do that but I can find no other way of getting small values. I
have successfully used the strings so obtained with .setValue (...).
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:
Sub GetValue()
Dim oSheet
Dim d As Double
oSheet = ThisComponent.getSheets().getByIndex(0)
'Inspect(oSheet)
d = oSheet.getCellByPosition(0,0).getValue()
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.
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info: http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]