Errors in Wiki Examples?

Creating a macro - Writing a Script - Using the API

Errors in Wiki Examples?

Postby slc193 » Mon Jul 21, 2008 9:58 pm

So I am copying code off of the wiki pages, trying to learn and understand it. I am looking at the page:

http://wiki.services.openoffice.org/wik ... 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?
slc193
 
Posts: 11
Joined: Sat Mar 15, 2008 5:08 pm

Re: Errors in Wiki Examples?

Postby Hagar Delest » Mon Jul 21, 2008 10:58 pm

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.
AOO 4.1.7 on Xubuntu 19.10 and 4.1.5 on Windows 10 (with winPenPack port).
User avatar
Hagar Delest
Moderator
 
Posts: 28587
Joined: Sun Oct 07, 2007 9:07 pm
Location: France


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 2 guests