LibreOffice Calc: Unable to assign a macro to a button

Solved
Fantoche1 Posted messages 12 Registration date   Status Member Last intervention   -  
Fantoche1 Posted messages 12 Registration date   Status Member Last intervention   -

Hello

I created a management file with several sheets. Sheet 1 is the input. Creating a Save button does not allow assigning the macro to automatically fill the other sheets.

The macro works when I edit it and press F5.

But when I create the button and then Tools > Events > Run Action... then I click on Macro... everything closes.

I completely uninstalled LO and reinstalled the latest version from the official site. I’m on Windows 10 CG Nvidia 940MX.

Thanks for your advice

6 answers

  1. yclik Posted messages 75 Registration date   Status Member Last intervention   1 612
     

    Hello

    1) Is macro security indeed disabled?

    Tools > Options > LibreOffice > Security > Macro security: Medium mode

    if yes, save the document and reopen

    2) Is the form drafting mode properly disabled (form control toolbar wrench icon)

    0
    1. Fantoche1 Posted messages 12 Registration date   Status Member Last intervention  
       

      Hello

      Yes, to assign the button, you must stay in design mode. Macro security has been tested at all levels, with no improvements.

      0
  2. JCB40 Posted messages 3068 Registration date   Status Member Last intervention   479
     

    Hello

    An example of the file would be very handy

    Best regards


    0
    1. Fantoche1 Posted messages 12 Registration date   Status Member Last intervention  
       
      From a blank Calc file... Create a button... Right-click... Controls... Events... Run action... And when clicking on Macro everything closes. It is not possible to access the window to choose the macro. A simple Macro "Msgbox Bonjour!"... works fine from the macro editor... But it is not possible to assign it to a button or a rectangle...
      0
  3. yclik Posted messages 75 Registration date   Status Member Last intervention   1 612
     

    Hello

    Attempt a profile purge

    Close Libre Office
    press the WINDOWS key (a flag) and R (simultaneously).
    -Then type %appdata%
    -Find the libreoffice folder
    -Rename it Oldlibreoffice

    0
    1. Fantoche1 Posted messages 12 Registration date   Status Member Last intervention  
       

      I will try... Do it... No success.

      0
  4. Fantoche1 Posted messages 12 Registration date   Status Member Last intervention  
     

    I’m back to share the research result. With the help of ChatGPT I found a lead. The file pythonloader.py is the culprit. I renamed this file by adding .bak... Then I tested again and everything works fine. The basic macros I had created work with the Save button... which wasn’t the case before.

    By leaving .bak on the file, I can continue to progress in my Calc file... the basic macros are functional. But I won’t be able to use complex macros since they would rely on Python. Best regards.

    0
  5. yclik Posted messages 75 Registration date   Status Member Last intervention   1 612
     

    hello

    great

    where is pythonloader.py located?

    0
    1. Fantoche1 Posted messages 12 Registration date   Status Member Last intervention  
       
      <voir> Program Files/LibreOffice/Program </voir>
      0
      1. yclik Posted messages 75 Registration date   Status Member Last intervention   1 612 > Fantoche1 Posted messages 12 Registration date   Status Member Last intervention  
         

        Hello

        thank you

        indeed I have this file

        After research useful for the macros made in Python

        0
      2. trotte-menu Posted messages 909 Registration date   Status Member Last intervention   355 > Fantoche1 Posted messages 12 Registration date   Status Member Last intervention  
         

        Hello and thank you for this info,

        For Mac users, file path:
        Applications Menu > LibreOffice.app > right-click > Show Package Contents > Contents > Resources > pytonloader.py

        0
  6. Fantoche1 Posted messages 12 Registration date   Status Member Last intervention  
     

    Sorry, I’m back with one final update. The origin of the problem is none other than the antivirus.

    In the end, it was Malwarebytes that detected LibreOffice using a system command "cmd" and, for safety, it closed LibreOffice. LO works perfectly without renaming any file. I just unchecked LO among the applications protected by the antivirus.

    0