Created attachment 83308 [details] Excel file containing VBA code to launch libreoffice and attempt to run a macro in another document ( expected to be located at C: ) - will attach also Can't invoke macros/scripts from VB. All attempts to access the 'getScript' method of the document scriptprovider will fail. I've marked the earliest release as 3.5 ( I'm pretty sure this goes back way further than that, earliest LO I have here is 3.5 ) e.g. Sub invokeLOMacro() Dim sURL As String sURL = "vnd.sun.star.script:VBAProject.Module1.CalledFromImportedXLS?language=Basic&location=document" Dim loServMgr As Object Set loServMgr = CreateObject("com.sun.star.ServiceManager") Dim oDesk As Object Set oDesk = loServMgr.createInstance("com.sun.star.frame.Desktop") Dim oDoc As Object Dim args(1) Set args(0) = MakePropertyValue("Hidden", False) Set args(1) = MakePropertyValue("MacroExecutionMode", 4) ' "4" is com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN Dim nullArray() Set oDoc = oDesk.loadComponentFromURL("file:///c:/MacroXLS.xls", "_blank", 0, args()) ' Dim scriptProv As Object Set scriptProv = oDoc.getScriptProvider() Dim xScript As Object Set xScript = scriptProv.getScript(sURL) '<==== will fail here The net result is it is not possible to invoke libreoffice basic, java, python etc. scripts from VB ( using the scripting framework )
Created attachment 83309 [details] corrosponding data file for the previous document
note: the root cause of the problem is in the scripting framework itself where there is a XNameAccess implementation, the XNameAccess implementation is throwing when ole bridge is attempting to figure out if there is a property called "getScript". Apparently ( I had forgotten this ) we treat any named elements in an object ( exposed via XNameAccess ) as properties. The scripting framework shouldn't throw in this instance ( it thinks the MasterScriptProvider isn't initialised correctly ) Solution is to fix the logic in the MasterScriptProvider implementation
well of course this is for me
Created attachment 83310 [details] A simpler example, shows the root cause but doesn't test the affected (e.g. olebridge )functionality
also reviews requested for 4.0 https://gerrit.libreoffice.org/#/c/5207/ & 4.1 https://gerrit.libreoffice.org/#/c/5206/
Noel Power committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=92500896a9d0ba873c06a4a2728eb5a1b9d8f68d fdo#67547 fix access to methods (getScript) of MasterScriptProvider from VB The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Noel Power committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=6add3c38a82bbac7e096327277707ba4858bf26a unit ( slowcheck ) test for fdo#67547 The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Noel Power committed a patch related to this issue. It has been pushed to "libreoffice-4-1": http://cgit.freedesktop.org/libreoffice/core/commit/?id=6a3c26a46c28ca1bcc26f4cc546b9facafe7030a&h=libreoffice-4-1 fdo#67547 fix access to methods (getScript) of MasterScriptProvider from VB It will be available in LibreOffice 4.1.1. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Noel Power committed a patch related to this issue. It has been pushed to "libreoffice-4-0": http://cgit.freedesktop.org/libreoffice/core/commit/?id=cba4eda4c9ca1174d7b9f3db821fc3452b4af486&h=libreoffice-4-0 fdo#67547 fix access to methods (getScript) of MasterScriptProvider from VB It will be available in LibreOffice 4.0.6. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.