Sub Main
Dim wb, ws1, cell1 As object
wb=ThisComponent
ws1=wb.Sheets.getByIndex(0)
cell1=ws1.getCellByPosition(2,0)
cell1.SetValue(12)
msgbox cell1.getValue
exit sub
'BASIC runtime error
'Property or method not found: Sheets
What's the problem?
Last edited by Hagar Delest on Fri Nov 24, 2017 9:38 am, edited 2 times in total.
Reason:tagged solved
Your code works for me after I changed "exit sub" to "end sub". What steps are you taking to run the code? Where is the macro stored? In my case, I stored the macro within the Calc document.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
I just went back and it runs for me now, too. The exit sub doesn't matter; I had other code following what I posted that had nothing to do with the problem. When I added Option VBASupport 1 at the top of the module (based on some other stuff I had read in this forum), the error message changed to "BASIC error '436' or some such. Now, as I said, it runs error free. Although it's no longer relevant, I have no idea where it's stored--don't even really understand the question. I just opened an Open Office spreadsheet and got to the module through clicking on Tools. Well, live and learn--though I don't know what it is I really learned.