Page 1 of 1

Property or method not found

Posted: Mon Dec 03, 2007 10:00 am
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

Re: Property or method not found

Posted: Mon Dec 03, 2007 11:23 am
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.

Re: Property or method not found

Posted: Mon Dec 03, 2007 11:02 pm
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.