Hi Christian,
tried your code and found out one possible error:
Don't know your exact implementation (especially how you named the macro
to call exactly), but if it is as it seems in your posted code, you're
using the standard names for library (in document), module and macro.
"vnd.sun.star.script:Standard.Main.main?language=Basic&location=document"
But the standard name of the module would not be Main but f.e.: Module1.
Nevertheless as I changed only this in your code to
"vnd.sun.star.script:Standard.Module1.main?language=Basic&location=document"
I could call the macro main in the module Module1 in the library Standard in
the open document.
Just a possibility
Hope it is just that
Christoph
Christian Andersson wrote:
> Hi there, I'm trying to integrate openoffice (2.0.3) into an web-based
> application (that today is using word)
> but I have now come up against a small problem.
>
> I need to call a macro inside an writer document from a visual basic
> script that is running inside internet explorer.
>
> I have no problem opening the writer document from the visual basic
> script, I can also manipulate the document from the script, but after
> all of this is done I need to call a macro inside the document. but
> sofar I have not come up with a sollution.
>
> I have tried the new scripting system like this.
>
> oScriptProvider = oDoc.getScriptProvider()
> oScript =
> oScriptProvider.getScript("vnd.sun.star.script:Standard.Main.main?language=Basic&location=document")
> oScript.invoke(Array(),Array(),Array())
>
> unfourtunally I have some problem getting the error handling working so
> all I can say is that I get some kind of error/exception with the
> getScript("vnd..... function
>
> I have also tried using the dispatcher to call the macro
>
> oDispatch.exeutedispatch("macro:///Standard.Main.main()","",0,Array())
> oDispatch.exeutedispatch("macro:///vnd.sun.star.script:Standard.Main.main()","",0,Array())
> oDispatch.exeutedispatch("macro:///vnd.sun.star.script:Standard.Main.main?language=basic&location=document","",0,Array())
> oDispatch.exeutedispatch("macro://"+docname+"/Standard.Main.main()","",0,Array())
> oDispatch.exeutedispatch("macro://"+docname+"/vnd.sun.star.script:Standard.Main.main()","",0,Array())
> oDispatch.exeutedispatch("macro://"+docname+"/vnd.sun.star.script:Standard.Main.main?language=basic&location=document","",0,Array())
>
> but no luck, there is no error when using the dispatch, but the script
> is not called.
>
> The document is opened visible so it should not be related to the bug
> #69552 (*1)
> The document opened is a template, but when I'm using
> loadComponentFromUrl I have set the properties
> ExecuteMacroMode to 4
> asTemplate to true
>
> if I dont add asTemplate = true, the macros I have on the "oncreate"
> event will not be called. and the macro security is currently set to low
> so It i snot that problem either
>
> can anyone shed som light on this?
>
> *1 http://qa.openoffice.org/issues/show_bug.cgi?id=69552
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]