I have two doc LibreOffice calc test1.ods and test2.ods. I want run a script in test2 from the script of test1.
- When test2 is open by the script of test1, i can't run the script on test2 even from test2. How i can pass out the security for the test2 doc ?
- How i can run automaticly the scrip on test2 from the script on test1 ?
REM ***** BASIC *****
'Script on Test1
Sub Main
Dim urlDest As String
Dim PropFich(1) As New com.sun.star.beans.PropertyValue
Dim oDocDest As Object
PropFich(0).Name = "MacroExecutionMode"
PropFich(0).value = com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE
urlDest = ConvertToUrl("/home/patrick/Bureau/Test/test2.ods")
oDocDest = StarDesktop.loadComponentFromUrl(urlDest, "_blank", 0, PropFich())
' ...
'run oDocDest.Standard.Module1.Main() ???
End Sub
Get the script provider of the other document and use it to invoke the macro.
For this to work, you need to allow macros to run by going to Tools > Options > Security.