Page 1 of 1

Errors in Wiki Examples?

PostPosted: Mon Jul 21, 2008 9:58 pm
by slc193
So I am copying code off of the wiki pages, trying to learn and understand it. I am looking at the page: ... With_Forms

and copying the following code to my BASIC editor and trying to run it.

Sub OpenInvoice
Dim Doc As Object
Dim DrawPage As Object
Dim Form As Object

Doc = StarDesktop.CurrentComponent
DrawPage = Doc.DrawPage
Form = DrawPage.Forms.GetByIndex(0)
End Sub

But I get the following error:

"BASIC runtime error. Property or method not found." while it highlights line 7 of the code above.

Any help in understanding this? I am just starting to learn BASIC and not seeing where the error is. And why would faulty code be posted in the wiki? Ot what am I not quite understanding?

Re: Errors in Wiki Examples?

PostPosted: Mon Jul 21, 2008 10:58 pm
by Hagar Delest
I think that this is only a snippet, a part of a longer code just to show what's the beginning to do a specific task. Have you read the context? Create a blank text document in Writer, add a form control and run the macro, there is no error code. Note that the code in the wiki has not the EndSub command, meaning that it's not a complete code.

If you want to start with macros, dig this forum, there are links to material like in that thread: [Solved] Writing Macros - Where Do I Start?

Thanks to add '[Solved]' at beginning of your first post title (edit button) if your issue has been fixed.