Enabling calc macros on a spreadsheet

Version: 25.2.3.2 (AARCH64) / LibreOffice Community
Build ID: 520(Build:2)
CPU threads: 4; OS: Linux 6.12; UI render: default; VCL: x11
Locale: en-US (C); UI: en-US
Debian package version: 4:25.2.3-2+deb13u2
Calc: threaded
mike@RPI4b4:~> uname -a
Linux MikesPI 6.12.47+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.47-1+rpt1 (2025-09-16) aarch64 GNU/Linux

In calc/Tools/Options/Security/MacroSecurity/ with Security Level set to Medium and Trusted Sources including /home/mike/docs/finance/stocks, still /home/mike/docs/finance/stocks/stocks.ods requires to be told to enable macros when loading.
Is seems that stocks.ods should load with macros enabled by default.
What am I not understanding?
Thanks,
Mike

If you have the macro (user-defined function) in the same ODS, then the file should not request confirmations to execute it.

But your question is not specific enough to decide if that’s a bug, or you do something incorrectly. I created this document:

UDF.ods (9.6 KB)

with a single formula =UDF() in A1, where UDF is implemented in the document’s Standard/Module1 as

function UDF()
  UDF = 42
end function

And adding its location to the trusted sources, I get it loading without confirmations - in Medium, and also in High, and even in Very High security modes. This also works fine, when the document is in a subdirectory of a trusted location.

Maybe you did something wrong. Or maybe there is a specific action that exposes a bug - say, I can imagine some method of opening the document, where the document URL would not match the URL of the trusted location. More details needed.

  


see also Macro warning shows despite no macros contained in document

not from trusted sources.

Macro Security

Is the macro stored in the document or elsewhere?

1 Like

The spread sheet has many macros all in the document but rather than in Module1, I’ve split them into modules related to their functionality, as stocks, utils, named, tests, and several others. Is that what’s causing me to have to tell localc to enable macros each time it loads stocks.ods?
Cheers,
Mike

UDF.ods loads without asking for ‘Enable Macros’ here.
If after UDF.ods is loaded I then load stocks.ods in the same instance of localc stocks loads without ‘Enable Macros’ coming up.
Generating a Standard/Module1 in stocks.ods and putting a Sub in it doesn’t keep the ‘Enable Macros’ box from coming up when I load stocks by itself.
I can’t see a difference unless localc expects all macros to be in Standard/Module1 in which case what’s the point in having other modules?
What am I missing something?

Mike

Whether the file whose true path is /mc/docs/finance/stocks/stocks.ods is loaded from the jwm menu as
localc /mc/docs/finance/stocks/stocks.ods;
or from the xterm command line as
localc /mc/docs/finance/stocks.ods which is a link to the file the result is the same and the ‘Enable Macros’ box pops up.
Mike

Further explorations show that there are no Extensions loadded with this file and no actions connected to any events listed in Tools/Customize Events.
I say again the path to this file is listed in Trusted Sources.
What other details do you need?
If the fact that the macros aren’t in Standard/Module1 is the problem please have the courage to state that instead of saying “See @mikekaganski 's answer above.” I’ve read that answer several times and see nothing there that explains why I’m having this problem.
Mike
Mike

See @mikekaganski 's answer above.

I saw it, what’s your point?

Unfortunately, the forum doesn’t notify you of changes to previously published messages.
So, if UDF.ods file opens from a trusted folder without a warning, but yours does, please upload your file, deleting any sensitive data if necessary. Let’s try to reproduce this.

1 Like

Here is a stripped down version that still requires ‘Enable Macros’.
stocksMini.ods (106.5 KB)

On that ‘Enable Macros’ popup there is a help button which opens a page stating in LibreOffice - Security there is an option ’ Always trust macros from this source’.
I don’t see that, is it there and I can’t find it or did it go away without the help team noticing?
Thanks,
Mike

My steps:

  1. Launched LibreOffice with a “clean” profile (the C:\temp\LibreOffice2 folder didn’t exist before):
scalc.exe -env:UserInstallation=file:///c:/Temp/LibreOffice2
  1. Saved your file to the C:\temp directory and opened it from Calc. A macro warning appeared.

  2. Added the existing C:\Temp\Temp folder to the list of trusted folders.

  3. Closed LO and copied your file to C:\Temp\Temp.

  4. Repeated step 1 (the C:\Temp\LibreOffice2 folder already exists) and opened your file from C:\temp\temp. The file opens without a warning.

Please try following the same steps as I did.

Version: 25.2.6.2 (X86_64) / LibreOffice Community
Build ID: 729c5bfe710f5eb71ed3bbde9e06a6065e9c6c5d
CPU threads: 6; OS: Windows 10 X86_64 (10.0 build 19045); UI render: Skia/Vulkan; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: CL threaded

I (unfortunately) guess the question is (now) why there’s a warning when you click on

I’ve done what you did, seen what you saw. No ‘Enable Macros’ popup after setting /tmp/test under Trusted Sources.
Now the question is what in the profile is causing the problem.
Comparing the profile under /tmp/test and ~/.config/…/modules, under ~/.config there are two extra modules, those being StartModule and BasicIDE. The only entries under ~/config/…modules/ are in both scalc/toolbar and BasicIDE/toolbar and those are *.xml files generated by localc itself. Surely those configurations of how I want to see on the taskbars is not enough to cause the ‘Enable Macros’ popup.
You’ve given me direction for further exploration so ‘Thank You, Much’.

Mike

Oops I missed one.
~/.config/libreoffice/4/user/config/fontnameboxmruentries isn’t paired in /tmp/test/user/config but copying it there didn’t affect how /tmp/test/stocksMini.ods loaded.
Challenges make life interesting.
Mike
Another point of interest is that the toolbar configurations I set up in /mc/docs/finance/stocks/stocksMini.ods carry over to /tmp/test/stocksMini.ods even though those *.xlm files are not under /tmp/test. This suggests there are other locations for configuration or some of the configuration is inside the *.ods
file.
I’ll try moving those *.xlm files and see what happens.
Mike
When I moved those *.xlm files from under ~/.config/… the toolbars for both localc and the BasicIDE for both copies of stocksMini.ods. Those files and some empty directories under …/Modules/StartModule are the only differences I see in the two configurations.
BTW, putting those *.xlm files back restored my prefered toolbars showing that that configuratio is not imbedded in the file.
Removing the …/Modules/StartModule/ directory did nothing that I can tell to the functioning of localc.
Chasing the permissions of both directory trees /tmp/test and ~/.config/libreoffice I found all directories were set 750 except for ~/.config/libreoffice/4 which was 700. Setting it to 750 didn’t change the occurance of the ‘Enable Macros’ popup.
Any suggestions for where else to look?
Mike

Typically, such problems are related to the file

..\LibreOffice\4\user\registrymodifications.xcu 

This file is usually large, and it’s difficult to pinpoint the specific cause.
I’ve been trying (for some time now :slight_smile: ) to log changes made to the configuration so I can start from scratch later.
By the way:

  1. Changes made to the menu and toolbars of modules are located here:
...\LibreOffice\4\user\config\soffice.cfg\modules 
  1. Contents of “My Macros”:
...\LibreOffice\4\user\basic 

You can continue this fascinating activity…


I also use several configurations on a regular basis (see -env:UserInstallation parameter above): for development and experimentation, a productive one (with minimal changes compared to the initial configuration)…

Thanks for that pointer.
I had put a link to /mc/docs/finance/stocks.ods in /tmp/test/ and found it loaded without the ‘Enable Macros’ popup displaying. That would have been a solution but seemed like putting a bandaid on a gunshot wound.
I copied …\LibreOffice\4\user\registrymodifications.xcu to old.registrymodifications.xcu then /tmp/test/user/registrymodifications.xcu to .\LibreOffice\4\user. After adding directories to Trusted Sources, stocks.ods loaded as expected.
I suspect as time goes by I’ll find things that the new registrymodifications.xcu need added but for now at least the current challenge is solved thank to you.
Thanks for the help.
Best wishes,
Mike

2 Likes

I found the problem through your suggestion of looking at registrymodifications.xcu.
Since that file is xml text I wrote a small script to strip out the xml garbage from the …\LibreOffice… version and the new one under \tmp then ran diff on them and noted where the old one’s Trusted File Locations were entered as $(HOME)/docs/finance, in the newer the entry was /mc/docs/finance. Change the entries in the old to match the new allowed localc to open stocks.ods without the ‘Enable Macros’ popup showing again.
Though there are c. 85 more entries in the old vs the new I suspect the biggest size difference in mine is that the old had ThumbTails stored in it.
Based on your C:… I assume you run Windows where I’m running Linux, never the less I’m sure you can find sed and grep for your system so here’s the script I used to strip the xml out of those regMod files:

#   registryMods.sed    Tue 28 Oct. 2025 8:09   Mc
#   a script to make .config/libreoffice/4/user/registrymodifications.xcu readable
#   usage:
#   grep -v Thumbnail .config/libreoffice/4/user/registrymodifications.xcu | sed -f registryMods.sed > regMods.txt
 
s\<item oor:path="/org.openoffice\\
s/"><prop oor:name="/    /g
s/" oor:op="fuse"><value>/    /g
s\</value></prop></item>\    \g
s\</it><it>\    \g
s/<it>/ /g
s\</it>\ \g
s\</value></prop></node></item>\\g
s/"><node oor:name=/    /g
s\</value></prop><prop oor:\    \g
s\</value></item>\    \g
s\</oor:items>\\

You’ll probably have to tweek it a bit for MS.

Thanks again for your help,
Mike McClain

1 Like