How do I recover macros after replacing my profile

Somehow my profile got corrupted so I renamed it as the wiki tells me to.

I copied the Basic folder from the renamed profiles to the new one but none of my macro libraries have returned. What else should I do to get them back? Do I have to register them in some way with LO? I’ve even rebooted in case that helped.

I’m pretty sure that last time I had to replace my profile the macros came back OK, but I can’t remember exactly what I did, and the wiki doesn’t say anything about it.

[Added later} Here are a couple of screenshots. One shows the File Explorer view of the Basic folder in the profile, the other shows the LO macros that are (and aren’t) there.

explorer view

LO view

The Basic libraries and modules actually need to be registered in a sense, but this is done by providing the files script.xlc and dialog.xlc in the basic folder and respectively script.xlb and dialog.xlb in the library folders. If these files are present in their placees in the new profile (dialog.xl? may be absent if no dialogs are defined in a library), and you don’t have access to the libraries/modules from LibO, I would doubt if you actually copied to the correct folder. If you define any new Basic module with an arbitrary Sub and leave LibO, is the module then saved to the expected location for the Standard library as a .xba file?

I’ve added two images, one of what Explorer sees and one of what LO sees. For some reason they don’t both appear within the message.

Aha! That’s the problem - the dialog.xlc and script.xlc didn’t get copied over - I must have clicked the “don’t overwrite” by mistake. The problems of programs keeping what’s meant to be the same data in two different places and the wiki not telling you how to make sure they’re in step…

Now, if you post this as an answer I can vote it up and give you brownie points.

I edited my answer the way you suggested. Please mote anyway that you also can answer your own questions.

Ah yes, but I think you get karma for good answers. And you deserve it for telling me something I didn’t know (not that hard).

Hopefully you made a backup of your previous user profile. If not you have lost your macros most likely.

Got to the backup and find the ...\user.bak\basic\ folder where user.bak is the supposed name of the backup folder.
Copy it completely and replace the newly created ...user\basic\ folder with it.

This is for Windows. For different OS regard LibreOffice user profile - The Document Foundation Wiki .

If you want to remove / change /add routines do it from the Basic IDE.

===Edit 2019-12-21 10:50 UTC===
As a result of the exchange via comments on the question I add the following:

The Basic libraries and modules need to be registered in a sense. This is done automatically by the Basic IDE writing to the files script.xlc and dialog.xlc in the basic folder and respectively script.xlb and dialog.xlb in the library folders.

When recreating the Basic part in a virgin user profile from the backup, these files need to also be correcctly copied to their places in the new profile (dialog.xl? may be absent if no dialogs are defined in a library). If they are present there and not corrupted themselves, everything should work.

A single module mName is saved to a mName.xba file in the library’s folder. The content, however is in XML and therefore many characters of the Basic code are escaped in html style. To recreate a module for which the .xlb file was lost. or which not correctly is listed in the .xlc file via the Basic IDE is annoying therefore. It may be easier to very thoroughly create/edit manually the needed XML files instead.

(This comment below by the OQ @ptoye was posted before the answer was edited.
Edited by @Lupp)

Thanks. But that’s what I’ve done :frowning: I’ll edit the original question to add a couple of screenshots.

{added later] I’ve added two images, one of what Explorer sees and one of what LO sees. For some reason they don’t appear within the message - you have to click them.