Macros not saving and not working/

Hi, I migrated from excel a year or so ago. Up until recently all my old macros (linked to "push buttons) worked fine. Now I am finding that:-
a/ they have all disappeared
b/ when I try and save a new one it does not appear next time I open the file
c/ even when I create a new one it does not run
d/ I can’t get a macro to “link” to a button?

I have been all over the interrnet and done everything that has been suggested but I still can’t get them to work. (ie all the various youtube tutorials on creating macros and linking them to a button.

The odd thing is that if I open open an older file with macros in them they all work fine??

Any help appreciated…

Many thanks…

What file type are you using? the LibreOffice macros will not be saved into a MS file type.

Can you upload a problematic sample file here, what contains the macros and the buttons?

1 Like

Seems you are working with “file formats” introduced by MS. That’s told to always be error-prone and dangerous in a sense.However, if it worked satisfyingly for you, that should be your choice.

  • Did the issues start with an upgrade of LibO? If so: From what old version to what new one?
  • May your uiser profile have been replaced (recreated) on such an occasion?
  • Did you check the options under >Tools>Options>Load/Save concerning MS “formats”.
  • Was VBA code edited in the documents showing the issue?
  • Did you thoroughly reconsider if you actually need the “macros” in VBA style?
    MS generally encourages the usage of VBA as an additional means of customer lock-in. In many cases they do banal things better done without macros, or sometimes with macros written for LibO using its native means. LibO has an efficient(often, not always) API while MS office melted down API and programming language in one.
1 Like

Hi and thanks for the replies. I have enclosed a stripped out version of the spreadsheets, one working the other not.

I have “resovled” the issue by simply uodating a slightly older back up copy which seems to work fine?

Macro not working.xls (14 KB)
Maxros work.xls (26.5 KB)

NB all these particular macros do is to copy from column a,b,c or d and then past the info into column “e”…

Hi all and thanks for the replies. Looks like it is a case of a corrupted file then. I will remember to do regular “back-ups” of any files I use in case it happens again. Must admit it is a lot more difficult to complete macros in Libre than Excel, but I suppose as Libre is free and I can no longer afford excel I will have to learn to live with it!..thanks again to all those that replied…

…thanks for the replies. I was orinally using Excel (2017 ish I think), I have not changed anything that I am aware of, although I have “upgraded” Libre office a couple of times. As suggested on a you tube vid I even tried saving as an alternative file type. Seems odd that all my old macros in previous files (excel) still work when opening them in Libre. Also find it odd that I can record a macro and then it simply wont work and “disappears” after I save the file and re-open it?

Sorry, we won’t learn about facts needed to help you from “seems odd” and the like.

  • Did you check the settings I already mentioned? How were they?
  • Did you also check the “macro scurity” settings under >Tools>Options>LibreOffice>Security ?
  • Did you consider to attach one of the files with still working macros, and one where you would expect macros, but don’t find them?
  • Did the issue start to occur after a specific upgrade? Which one?

BTW: Don’t write an “answer” (suggested solution) to give additional information. Better edit your original question or conmment on someone elses posts.

1 Like

We can not help you without specific sample files. Please upload at least a new one with the recorded macros inside.

Macros don’t work in file [Macro not working.xls] because there aren’t macros in such file.

The point is that the OP cannot add macros to that file. I confirmed that adding any macros is not possible. If you save the file then reload it you lose the entire Library (i.e. Module1). I also tried saving as an xlsm and got the same improper results. I’m guessing some manner of file corruption. I looked into the xlsm archive files and the only thing I saw glancing quickly is the that rels file doesn’t seem to be well-formed XML.

2 Likes

I also guess the original file could be corrupted.
I have included a new button on first sheet linked to a simple macro created in Module1, saved as .xls, open the file and it seems to be working. Attached file.
Same situation with a xlsm.
Maxros work with new macro linked to push buttom in sheet Base Info.xls (143.5 KB)

1 Like