Macro searched - splitting one document into pieces

Is there by good luck a prefab macro which does this

  • select every H2 - header of a document
  • write their contents each into a new rtf-document named alike the header

In other words:
Split a document into many small ones and name them by automatically?

So we have as example
h1: Main Header
h2: sub header
some text

We want a document by the name of
sub header.rft
containing
“some text”

Check if File|Send|Create Master Document serves you; check that the paragraph style you need is selectable in the Save As dialog. The resulting master document may be discarded afterwards if not needed; but the chapters would be stored as normal Writer documents.

But indeed - custom naming the chapter documents is not possible - it would be “name of master document plus a number”.