I will appretiate very much if you guys can help me get started with oo basic programming. I've done quite a bit of excel macro programming and I am trying to move to OpenOffice but nothing seems to work. I copied this code from OpenOffice wiki but I get the following error pointing to the "oControl = oForm.getByName..." line
Basic runtime error.
An exception ocurred
Type: com.sun.star.container.NoSuchElementException
Message: .
Sub SetMyCheckBox
Dim oForm
Dim oControl
Dim oSheet
Dim oCell
oForm = ThisComponent.Sheets(0).DrawPage.Forms.getByIndex(0)
oControl = oForm.getByName("MyCheckbox")
oSheet = ThisComponent.Sheets(0)
oCell = oSheet.getCellRangeByName("A1")
If oCell.Value = "1" then
oControl.Value = "True"
Else
oControl.Value = "False"
End If
End Sub
All I have in my spreadsheet is a CheckBox labeled and named "MyCheckBox"
Last edited by robleyd on Wed Apr 11, 2018 6:55 am, edited 1 time in total.
Reason:Tagged [Solved] [robleyd, Moderator]
Please download, install and use one of the existing object inspection tools, like the XrayTool or the MRI. Then you will able to examine the properties, methods of the programming objects.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
I appretiate very much your advice. The uppercase "B" got rid of the error message of my initial question (my mistake), now the error message is in the line:
"oControl.Value = ..." Property or method not found: Value.
which I find very surprising as this code was copied from OpenOffice wiki (my only addition was creating the CheckBox on the spreadsheet).
At this moment I am downloading and installing Xray, and reading the Guides suggested by Zizi64 . After that I'll go into MRI. My hope is to finally figure out why Value is not found and what are the correct and valid names of the properties and methods I need for my purposes.
I found the correct and valid names I needed in the Basic Guide, Control Element Forms in Detail, here:
The XrayTool can list all of the Properties, Methods, Services, Interfaces and Listeners "in situ".
Here is an example with a shape Object:
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.