Macro's in embedded calc document do not run

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
TdO
Posts: 2
Joined: Mon Jul 16, 2012 10:38 pm

Macro's in embedded calc document do not run

Post by TdO »

Hello,

I discovered that once you embed (insert as OLE object) a calc document (either by linking or by copying) in a writer document the macro's in the calc document no longer run.
Also if you edit in place, forcing recalc by pressing F9 in the correct cell or Ctrl-Shift-F9 to recalc the whole spreadsheet does not help.
The documents are not protected, macro's are enabled to run.

Is this by design ?
Is there a way to force the macro's to run ?

I attached a spreadsheet and writer document to demonstrate the problem, just place them in the same directory.
I use Open Office version 3.4.0 on Windows 7, 64-bit.

Regards,

TdO
Attachments
DocWithSpreadSheet.odt
document which contains the embedded spreadsheet
(9.47 KiB) Downloaded 343 times
EmbeddedCalcDoc.ods
Spreadsheet to embed
(8.41 KiB) Downloaded 355 times
Open Office 3.4.0, Windows 7, 64 bit
User avatar
Charlie Young
Volunteer
Posts: 1559
Joined: Fri May 14, 2010 1:07 am

Re: Macro's in embedded calc document do not run

Post by Charlie Young »

I suspect it is by design, the embedded sheet has AllowMacroExecution disabled, and I haven't found a way to enable it. If the TestRun macro is put in "My Macros," which is of course accessible to Writer, then it does run. This is a curious state of affairs.
Apache OpenOffice 4.1.1
Windows XP
TdO
Posts: 2
Joined: Mon Jul 16, 2012 10:38 pm

Re: Macro's in embedded calc document do not run

Post by TdO »

Thanks for the information, that will fix the operational issue.

Still for a better solution :
Would it be possible to get callbacks/events when an embedded document is at the point of being loaded ?
If I could change the loading parameters like :

Dim args(0) As Object
Set args(0) = objServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
args(0).Name = "MacroExecutionMode"
args(0).Value = 4
Set objDocument = objDesktop.loadComponentFromURL("file:///c:/Test/DemoCode.sxc", "_blank", 0, args())

I could allow the macro's to run in the embedded documents.
Or is there a way to set the MacroExecutionMode of an already loaded document ?

TdO
Open Office 3.4.0, Windows 7, 64 bit
randomname2
Posts: 1
Joined: Mon May 01, 2017 6:41 pm

Re: Macro's in embedded calc document do not run

Post by randomname2 »

Maybe you need choose a different macro security policy?

Menu bar -> Tools -> Options -> LibreOffice -> Security -> Macro security -> Security level -> Medium -> OK
LibreOffice 1:5.3.1-0ubuntu2 Linux 4.10; UI-Render: Standard; VCL: gtk3; Layout-Engine: neu; Gebietsschema: de-DE (de_DE.UTF-8); Calc: group; OS: Ubuntu GNOME 17.04
Post Reply