Use the API functions for crating a new empty Calc document (or for opening an existing one)
https://forum.openoffice.org/en/forum/v ... entfromURLWhat you want to copy: texts, numbers, formulas, direct formatting properties, cell styles???
There are many ways to achieve this task by a macro code...
Finally you can save (store) the new document, and you can close it by API functions:
StoreToURL() or StoreAsURL(), oDoc.Close() or oDoc.Dispose()
Please, please, please READ the descriptions that we suggested for you in the past: Andrew Pitonyak's macro books, and the API descriptions...
Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.3.3; AOO4.1.6
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.