Tom Schindl wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Matthias Benkmann wrote:
On 10/17/05, Alexander Peters <[EMAIL PROTECTED]> wrote:
Hello!
I use OLE to connect to OpenOffice.org Writer and want to get
Returncodes from Macros which i execute with a dispatcher. How can i
make this? Or is there an other way to execute macros to get a
returnvalue? Any Codesnip in any language will help me.
If you don't need compatibility with versions prior to 2.0, you can
use the Scripting Framework (Developer's Guide chapter 18).
The involved services and interfaces are
The following code demonstrates the SFW:
Sub Main
doc = ThisComponent
scriptProvider = doc.getScriptProvider()
script =
scriptProvider.getScript("vnd.sun.star.script:Standard.Module1.Foo?language=Basic&location=document")
retval = script.invoke(Array("Hallo World"), Array(), Array())
MsgBox(retval)
End Sub
Function Foo(st as String) as String
MsgBox(st)
Foo = "Bye Bye"
End Function
Matthias
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
This would be a great short code-snippet ;-)
Tom
Tom, Matthias, Alexander,
I suppose my example was too elaborate. The essence was in
calling the function, which returns a value, just as it does in
Matthias Benkmann's example.
But the code snippet can be much shorter, because you don't
need the scriptProvider at all:
Sub shortMBNKMN
MsgBox Foo( "Hello World" )
End Sub
Function Foo(st as String) as String
MsgBox(st)
Foo = "Bye Bye"
End Function
This gives exactly the same result.
Sincerely,
Gerrit Jasper
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]