My guess is that you attempted to run this from the Basic IDE.
This example starts with :
Doc = StarDesktop.CurrentComponent
This sets the variable Doc to reference the current component, which
references the Basic IDE. Change the line to read:
Doc = ThisComponent
which causes Doc to reference the last current document. Make certain
that the last current document was a Draw document. See if this helps.
Singh wrote:
Hello
I have not programmed in BASIC for decades and in VBA ever, but I am
trying
to learn Starbasic to write some macros on openoffice.org Draw.
I am trying out the following example :
---------------------------------------
REM ***** BASIC *****
Sub Main
Dim Doc As Object
Dim Page As Object
Dim RectangleShape As Object
Dim Point As New com.sun.star.awt.Point
Dim Size As New com.sun.star.awt.Size
Doc = StarDesktop.CurrentComponent
Page = Doc.drawPages(0)
Point.x = 1000
Point.y = 1000
Size.Width = 10000
Size.Height = 10000
RectangleShape = Doc.createInstance("com.sun.star.drawing.RectangleShape")
RectangleShape.Size = Size
RectangleShape.Position = Point
Page.add(RectangleShape)
End Sub
------------------------------------
Now, when I try to run this macro, I get the following error wherever I have
a method invocation (like Page=Doc.drawPages(0) or RectangleShape=Doc....
above) :
BASIC runtime error.
Property or method not found.
I am using OpenOffice.org 2.2.1 on Debian with Sid (unstable) packages. I
definitely have the openoffice.org-dev (SDK) package installed. I have
checked to make certain of that.
What am I missing in my installation ?
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info: http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]