Use a macro to place something at the end of a paragraph

I need to place an object (in this case it’s a textbox created with Insert>Text Box at the end of a paragraph using a macro. It’s possible with the GUI by right-clicking and clicking “Position and Size” and setting the Vertical position to “Bottom” to “Entire Paragraph Area”. Is there a way to do this in a macro?

My version info is:
Version: 7.5.7.1 (X86_64) / LibreOffice Community
Build ID: 47eb0cf7efbacdee9b19ae25d6752381ede23126
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded

Thanks in advance for any responses.

Not answering to the question. Are you sure yu need a text box? A text box is a Drawing Object, a geometric shape, which has limited possibilities, notably in formatting. The “correct” container for text is a frame. A frame provided a full-fledged independent sub-document, not larger then a page though. A frame can be controlled by a frame style while drawing objects like text boxes can’t and must be manually formatted and positioned.

So, instead of a text box + macro, you should consider a frame controlled by a common style. This would provide the automation you’re looking for. But, yes, frame styles are difficult to tame, even for experts. And above all, they don’t tolerate any direct formatting if you expect stability.