For me it is most important that you can access different cells on the sheet so you can run all your logic on them.
First I filled 4 cells this way:
I want to display the contents of 1 cell of the current sheet with message box. In this table you can compare the few lines of code in both languages.
|1||Sub test()||Sub test|
|2||Dim oSheet As Worksheet||Dim oSheet|
|3||Set oSheet = ActiveSheet||oSheet = ThisComponent.CurrentController.ActiveSheet|
|4||MsgBox (oSheet.Cells(1, 1))||msgbox(oSheet.getCellByPosition(1,1).String)|
|5||End Sub||End Sub|
1st line: the same. LibreOffice can run without ()
2nd line: in VBA you specify the type of object. in LOB there is only one type - object. And if you omit the type (i.e. Dim oSheet
3rd line: in LOB the object model is different! You don't need SET statement any more, because there is only one object type in LOB! Downwards you will find a link with more info
4th line: msgbox command is similar. Note that Cells(1, 1) returns cell A1, BUT getCellByPosition(1,1).String returns cell B2, it is 0 based !!!
5th line: the same
And here is the result in LOB....
You can find an excellent document comparing VBA and LibreOffice Basic (StarBasic) here: