2010/6/12 Harrie Borgers <[email protected]>:
> L.S
>
>
>
> A novice's requires
>
> Where can I read more about: args(0)
Not sure, sorry.
>
> How to call - in basic - a second spreadsheet with variable name
What do you mean by ”call” in this case? Sorry, my native language is
not English, but I try the best I can. Do you want to create a new
spreadsheet and give it a name?
Have you read Andrew's Macro document? If not I think it would be a good idea.
>
> How do I read out the value of cell(3,4) for calculation
If you mean cell D5, try this:
'----------------------------------------------------------------------------------------------------------------------------------------------
REM ***** BASIC *****
Option Explicit
Sub Main
Dim x As Double
x=ThisComponent.getSheets().getByName("Tabell1").getCellByPosition(3,4).getValue()
Print x
End Sub
'----------------------------------------------------------------------------------------------------------------------------------------------
Same thing again, but more readable and with some extra comments:
'----------------------------------------------------------------------------------------------------------------------------------------------
REM ***** BASIC *****
Option Explicit
Sub Main
Dim Doc As Object, Sheet As Object, Cell As Object
Dim x As Double
Doc=ThisComponent
Sheet=Doc.getSheets().getByName("Sheet1")
Cell=Sheet.getCellByPosition(3,4)
x=Cell.getValue()
' You can also get the formula from the same cell:
' Dim CellFormula As String
' CellFormula=Cell.getFormula()
' And if the cell contains a string:
' Dim CellString As String
' CellString=Cell.getString()
Print x
' Print CellFormula
End Sub
'----------------------------------------------------------------------------------------------------------------------------------------------
A nice thing to do is to install something called ”xray”. It helps a
lot to find methods of objects and things like that.
For example:
'----------------------------------------------------------------------------------------------------------------------------------------------
REM ***** BASIC *****
Option Explicit
Sub Main
Dim x As Object
x=ThisComponent.getSheets().getByName("Tabell1")
xray x
End Sub
'----------------------------------------------------------------------------------------------------------------------------------------------
This will open a dialog in which you can see all the available
methods, variables and more for that object.
I think you can find xray by any search place, such as google. It's
easy to install too.
Johnny Rosenberg
>
>
>
> Arie bor
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]