Christoph Jopp wrote:
> 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

if the macro would not be called just because *I have renamed the
module, I think it would had been a extremly serious bug and someone
should had noticed it before..

the macro is located in the library named Standard and in the module
Main and the macro is not named main as I wrote in the message but
something else, but I use the exact same names in the openoffice code
and in the visual basic code..

just to make sure, I tried the code from within openoffice (in starbasic)

    oDispatcher.executeDispatch
Thiscomponent.getCurrentController().getFrame(),
"macro://"+docname+"/Standard.Main.test()", "", 0, Array()

this works as expeted, the test function was called
when running this line

using the script system also works.
    Dim oScript, oScriptProvider
    set oScriptProvider = ThisComponent.getScriptProvider()
    set oScript =
oScriptProvider.getScript("vnd.sun.star.script:Standard.Main.gbsmain?language=Basic&location=document")
    oScript.invoke(Array(),Array(),Array())

so from openoffice basic both methods work (as long as I use the right
url with the dispatcher)

Observe this was just a simple test within the same document , I did not
use loadComponentFromUrl and call a macro in a different document

> 
> 
> 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]
> 
> 

-- 
Christian Andersson - [EMAIL PROTECTED]

Configuration and Collaboration for OpenOffice.org
Open Framework Systems AS http://www.ofs.no

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to