Property or method not found

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
User avatar
onidarbe
Posts: 84
Joined: Thu Nov 29, 2007 8:03 pm
Location: Belgium, Mechelen

Property or method not found

Post by onidarbe »

Well I'm new to programming OO, comming from Excel/VBA ;-)
I start a new Calc, I add following lines under "organize macros/Openoffice.org-Basic.../Unlitled1/standard/new", and get the error "Property or method not found" as soon os I want to step over " Sheet = Doc.Sheets.getByName("Sheet1") "
I also tried " Sheet = Doc.Sheets(0) " with same problem ! What am I doing wrong?

Sub sTest
Dim Doc As Object
Dim Sheet As Object
Dim CellRange As Object
Doc = StarDesktop.CurrentComponent
Sheet = Doc.Sheets.getByName("Sheet1")
CellRange = Sheet.getCellRangeByName("A1:C15")
End Sub
OOo 3.1.X on Ms Windows XP
B Marcelly
Volunteer
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: Property or method not found

Post by B Marcelly »

Hi,
Programming questions should be posted in the Macros forum or one of its sub-forums.
Use the Code button to enclose your code lines.
JohnV
Volunteer
Posts: 1585
Joined: Mon Oct 08, 2007 1:32 am
Location: Kentucky, USA

Re: Property or method not found

Post by JohnV »

Doc = StarDesktop.CurrentComponent
Use Doc = ThisComponent

StarDesktop.CurrentComponent when the macro is run from the Basic IDE is the IDE. ThisComponent is always the active document.
Post Reply