Where did all my macros go?

Windows 11 Pro (Build 26100)
Libre Office Version: 24.8.4.2 (X86_64)
EDIT: I found the toolbar. I also Googled where the macros are stored and I looked in the user folder for a folder called My Macros and a search found nothing. I still do not want to believe they are gone, there has to be somewhere they are located other than in that area. I don’t understand how they could have gotten deleted anyway.
Today, I go into to work on some sheets that I have quite a few useful macros in them and a friend who is using the sheet clicks on a button with a macro attached to it and it gets a scripting error, I go and check and all the macros are gone in the sheet. I then check my master sheet and the macros are gone from there also. I was going to check the button to see if the macro was still listed but it seems my toolbars were also changed inadvertently. I just worked on this sheet two months ago and everything was working fine.
I am not a coder and these macros where developed with a lot of help from this community and I put countless hours in trying to figure this out. I can’t believe these macros are completely gone.

  1. Where does the Libre Office store the macros on my PC so I can see about recovering them?
  2. What is the toolbar that allows me to edit and add buttons?

Depends on your operating system which you forgot to mention, along with the version of LO.

Apologies. I will edit the post.

Note that technically I don’t think it matters because this is the same on my PC running Windows 11, and my two laptops both running Windows 10 where one is updated and the other is not.
One of the laptops and my PC are on the same version of Libre Office, the other laptop has not been updated yet.
My primary laptop is set to sync to my PC automatically every so many days, but it has been off and has not run since about 3 weeks ago so those files have not updated. Also note that the files did work at the beginning of last month.

It is different on Linux, MacOS, FreeBSD and there can be differences between regular and portable installs (Windows), containers (snap, flatpack, appimage) and installed versions vor Linux. Also the versions from AppStore (Microsoft) behave differently.
.
So, if you give details you may get a better answer…
(It seems you found %APPDATA% for your Windows-Profile.)

The macros are in the folder ‘Basic’ in the ‘user’ folder. For the location of the ‘user’ folder you can look at Tools > Options > LibreOffice > Paths. Lot of those are located in the ‘user’ folder.

Inside the ‘user’ folder you will find files dialog.xlc and script.xlc. The content of script.xlc could be e.g.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:libraries PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "libraries.dtd">
<library:libraries xmlns:library="http://openoffice.org/2000/library" xmlns:xlink="http://www.w3.org/1999/xlink">
 <library:library library:name="Standard" xlink:href="$(USER)/basic/Standard/script.xlb/" xlink:type="simple" library:link="false"/>
 <library:library library:name="Scene3D" xlink:href="$(USER)/basic/Scene3D/script.xlb/" xlink:type="simple" library:link="false"/>
</library:libraries>

In the example, “Scene3D” is a library that I have created. For each of the libraries - that are the subfolders in ‘Basic’ folder - there should be a line. And for each of your linked libraries there should be a line too. Unfortunately, sometimes an update destroys the files script.xlc and dialog.xlc. I have not found an backup of them. It is a good practice to make a backup of the ‘Basic’ folder before installing an update.

If the lines are missing, you can add them manually using an editor. Or you go to the ‘Basic Macro Organizer’ and import the libraries again. For that you use the script.xlb file in each of the subfolders of the ‘Basic’ folder, the dialog.xlb will be read automatically then.

For the ‘Standard’ folder you need to repair the script.xlb and dialog.xlb files. (sorry, no more time now.)

In addition to the script.xlc mentioned by @Regina, each of the subdirectories has a script.xlb where the modules of a library are declared.
A “normal” script.xlb starts with

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="awt" library:readonly="false" library:passwordprotected="false">
library:readonly="false" library:passwordprotected="false">

… ends with …

</library:library>

… having entries like …

 <library:element library:name="Module1"/>
 <library:element library:name="Module2"/>
 <library:element library:name="Module3"/>

… in between where each module entry refers to a an xba file like Module1.xba, Module2.xba, Module3.xba.
If you have the Basic code in the xba files, you can manually restore the script.xlb file to the library folder, then add a library entry to the script.xlc and the macros appear in the macro dialogs after restarting the office suite.

This is what my script.xlc has in it:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:libraries PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "libraries.dtd">
<library:libraries xmlns:library="http://openoffice.org/2000/library" xmlns:xlink="http://www.w3.org/1999/xlink">
 <library:library library:name="Standard" xlink:href="$(USER)/basic/Standard/script.xlb/" xlink:type="simple" library:link="false"/>
</library:libraries>

Is it safe to assume that the 5 different modules I had are completely gone?

If you had only modules and not own libraries, these modules belong to the default library Standard. Each module of the Standard library has a file with extension .xba in the folder Standard. Only if these files are missing, the modules are really lost. Otherwise follow the answer from @Villeroy to repair the file script.xlb.

I did and that info I posted above was what he told me to look for and it’s not in any of those, so they’re completely gone.
I have been able to go back to my previous posts for all the macros and rebuild them, except for one and it’s the most simple one out of all of them. I am currently trying to work with ChatGPT to rewrite this one but so whatever code it gives me has not worked.

Of course not. Why should Microsoft allow its AI to write working code for LibreOffice? That AI engine has nothing to do with coding. It is pure guess work.
A sound backup strategy works since the 1960ies.

Microsoft’s AI is Copilot, but Microsoft is a major investor in OpenAI (ChatGPT).

The problems are:

  • Has the AI “read” about the API of open/LibreOffice?
  • Any knowledge of it or is it only heuristics what may come next?
  • Does it know about the subtle differences between VBA in MSOffice and StarBASIC in LibreOffice?

The result you may see in your new thread:

as well as in older ones of 2024, 2023, … :face_with_thermometer:
Need help getting this basic macro working
How to take a range of cells and put the entire range into another range

I thought he used snippets from different sites then, not AI.

Either way it ends up as Cargo cult programming - Wikipedia

so did AI :wink: