macro to convert plain text footnotes

I encounter a lot of documents of older books in which the footnotes or endnotes have been rendered in plain text right in the main text stream. Somewhere in a paragraph will be a marker like “[78]”, and then later on, at the chapter end or stuck in the text at what originally was the page bottom (but now no longer is) is the actual note, such as:

[78] There was, however, no community of goods.

In MS Word I had a macro that did an amazing job of finding, gathering and converting these notes to actual linked, sequential footnotes. It was beyond my own abilities, someone kindly wrote it for me. And I have far less ability in LO Basic than I did in VBA.

I’ve come up with a conceptional way to do it. Search backward from the end of file for [1], delete the found string, cut the ensuing paragraph. Then search again for [1] to get the footnote location, insert a footnote there, then paste the text into the footnote.

I’m sure it’s not the best method, but it works. But I have to figure out how to search for a variable, because I then need to increment the footnote number within a For/Next loop and start again. And I haven’t found that anywhere.

Does anyone have a clue how to create such a macro, or know of a likely place to ask?

I now have a working macro. If interested, contact me for details.

Hi Paul,

can you also post the relevant macro here?

@paul1149, I am in a need of such a macro. Could you please share it with me?

There is an extension named Altsearch which flawlessly does the job.

@paul1149, I am in a need of such a macro. Could you please share it with me?