Hi,
I try to create my first subroutine. Using OpenOfficer.org 3 CALC "Extras - Makros - Makros verwalten - OpenOffic.org Basic...". I copied varios example code form the manual, but every time the execution stops, when the line contains a command using objects. The following error is displayed: "BASIC Laufzeitfehler Eigenschaft oder Methode nicht gefunden" (means: BASIC runtime error attribute or method not found).
Example (from BASIC guide):
sub Ha
Dim Doc As Object
Dim Sheet As Object
Dim CellRange As Object
rem Globalscope.BasicLibraries.LoadLibrary("Tools")
rem GlobalScope.DialogLibraries.LoadLibrary( "Standard" )
Doc = StarDesktop.CurrentComponent
Sheet = Doc.Sheets(0) ' <- error on this line !!!???
Sheet = Doc.Sheets.getByName(1)
Sheet = Doc.Sheets.getByName("Sheet 1")
CellRange = Sheet.getCellRangeByName("A1:C15")
end sub
Somewhere I read to insert the commands now marked as comment lines (rem), but it doesn't helped. I use Windows XP. The error occurs on single step and normal execution.
Thanks for help
budo_flieger
[Solved] Runtime error using objects
-
- Posts: 3
- Joined: Sun Nov 23, 2008 10:13 pm
[Solved] Runtime error using objects
Last edited by budo_flieger on Wed Nov 26, 2008 10:44 pm, edited 1 time in total.
OOo 3.0.X on Ms Windows XP
Re: Runtime error using objects
What does symbol Doc refer to?
What is the current component of the StarDesktop?
http://www.pitonyak.org/oo.php
http://development.openoffice.org/?cid=926478#BASIC
What is the current component of the StarDesktop?
http://www.pitonyak.org/oo.php
http://development.openoffice.org/?cid=926478#BASIC
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Posts: 3
- Joined: Sun Nov 23, 2008 10:13 pm
Re: Runtime error using objects
Hi,
I expect, that Doc refers to the currently opened CALC file and Sheets adresses the currently opened spreadsheet. Doesn't it?
My original intend is to work with the cells in this spreadsheet by adding strings from cells of an other spreadsheet.
budo_filieger
I expect, that Doc refers to the currently opened CALC file and Sheets adresses the currently opened spreadsheet. Doesn't it?
My original intend is to work with the cells in this spreadsheet by adding strings from cells of an other spreadsheet.
budo_filieger
OOo 3.0.X on Ms Windows XP
Re: Runtime error using objects
You can not do any programming at all if you are not able to evaluate your symbols. Search for "Xray", install it, use it. Refer to the links I posted and read other people's code. There you may find the special Basic variable "ThisComponent", which refers to the last active document (including help documents!) when used in global context. In document context, ThisComponent always refers to the document containing the Basic code. http://wiki.services.openoffice.org/wik ... ment_basic
No, this is not even similar to VBA.
No, this is not even similar to VBA.
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Posts: 3
- Joined: Sun Nov 23, 2008 10:13 pm
Re: Runtime error using objects
yeah, that's it....
thanks, your recommendation was helpful (I didn't find this page on my own search for help...)
budo_flieger
thanks, your recommendation was helpful (I didn't find this page on my own search for help...)
budo_flieger
OOo 3.0.X on Ms Windows XP