tredegar |
08-14-2005 10:00 AM |
Simple Ooo BASIC Macro problem: "connot coerce argument type..."
Im using Openoffice 1.1.4, KDE3.3.2, Mandriva 2005LE, with updates. My java is jre1.5.0_04
I want a simple macro to insert some text into my document. For example:
Tools - Macro - Record
Type "test" <CR>
Mouse to Stop Recorder & stop it.
Save the macro as "Test"
When I run the macro I get:
Quote:
BASIC runtime error.
An exception occurred
Type: com.sun.star.lang.illegalArgumentException
Message: cannot coerce argument type during corereflection call!
[OK]
|
This is the code that Openoffice has generated for me:
Code:
REM ***** BASIC *****
Sub Main
End Sub
sub Test
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Text"
args1(0).Value = "test"
dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:InsertPara", "", 0, Array())
end sub
It falls over on the line:
dispatcher.executeDispatch(document, ".uno:InsertPara", "", 0, Array())
With the error I mentioned at the start.
Does anybody know what I have misconfigured?
Edit: misspelled the OOO error message
|