Where is a Custom Toolbar saved?

I use a Custom Toolbar with about three dozen favorite icons,
in Impress, Draw, Writer, etc:

image description

After hitting the Close (x) button accidentally, I realized it cannot be recovered.
It has to be redone manually–very time consuming. Where does the information go,
when you save it to LibreOffice Impress? Is there a configuration file? Can toolbars
be captured in a macro?

Hello,

Where custom toolbars reside depends upon where you save them. There is a Scope drop down in the customizing. If set to LibreOffice Impress then it will be in the user profile. See → LibreOffice user profile. You can make a copy of the file for backup.

You can also set the Scope to the .odp in use. In this case the file is embedded within the Impress document in the Configurations2 folder. You can use an archive manager to open but probably best just to copy the Impress file.

Can toolbars be captured in a macro?

Would think so. Have worked a bit with menus in macros (saving, restoring in memory) but not to save outside the process.

Thanks, Ratslinger! Just the kind of solution I was looking for.
Specifically, the XML file describing the toolbar elements is (in Windows 10) under:

      %$APPS%\LibreOffice\<version>\user\config\...\toolbar\custom_toolbar*.xml.

For me using writer in W/11: %UserProfile%\AppData\Roaming\LibreOffice\4\user\config\soffice.cfg\modules\swriter\toolbar