macro change focus from writer document to calc spreadsheet

external writer document as a form with buttons runs macro in Librecalc.
The macro in calc uses object “thiscomponent” and causes an error, because the active document is writer doc, as a form.
I need to transfer focus to Librecalc and the selected worksheet.
LO 6.3 Linux Mint 18.3