I've never played with LO macros before, and I have no idea if this is possible, but: At a certain point in the document I need to insert the document's filename (easy to do using fields), and then later on to insert the same filename after a simple search+replace operation (which is where I'm stuck).
I assume macros are the way to go but if there's a better/different way I'm all ears.