BASIC Macro seems unable to send "SPACE" keystroke

I tried creating a simple macro to repeatedly send 3 keystrokes: END, SPACE, DELETE. This is what I have been keying over & over to eliminate hard carriage returns in text from a source I regularly copy/paste into a presentation (impress). But the macro seems to only like sending END and DELETE, ignoring the SPACE keypress & release, which is vital for this to work properly.

I just have the macro repeating this 10 times for now. Ideally I’d like to detect when I’m at the end of the text, but that’s less important. If sending the space would work I could simply loop 100 times (or whatever) and it would remove the hard returns and add a bunch of spaces at the end if it ran too many times.

sub removeNewLines
	rem https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1awt_1_1Key.html
	Dim oWindow As Object, oToolkit As Object
	Dim oKeyEvent_EOL As New com.sun.star.awt.KeyEvent
	Dim oKeyEvent_SPACE As New com.sun.star.awt.KeyEvent
	Dim oKeyEvent_DELETE As New com.sun.star.awt.KeyEvent
	oWindow = ThisComponent.CurrentController.Frame.getContainerWindow()

	oKeyEvent_EOL.Source = oWindow		
	oKeyEvent_EOL.KeyCode = com.sun.star.awt.Key.MOVE_TO_END_OF_LINE  REM 1547
	oKeyEvent_EOL.Modifiers	= 0		REM A combination of com.sun.star.awt.KeyModifier.
	oKeyEvent_EOL.KeyChar = 0	REM using keycodes
	
	oKeyEvent_SPACE.Source = oWindow		
	oKeyEvent_SPACE.KeyCode = com.sun.star.awt.Key.SPACE  REM com.sun.star.awt.Key.SPACE  REM 1284
	oKeyEvent_SPACE.Modifiers	= 0		REM A combination of com.sun.star.awt.KeyModifier.
	oKeyEvent_SPACE.KeyChar = chr(32)
	
	oKeyEvent_DELETE.Source = oWindow		
	oKeyEvent_DELETE.KeyCode = com.sun.star.awt.Key.DELETE  REM 1286
	oKeyEvent_DELETE.Modifiers	= 0		REM A combination of com.sun.star.awt.KeyModifier.
	oKeyEvent_DELETE.KeyChar = 0	REM using keycodes

	oToolkit = oWindow.getToolkit()			REM com.sun.star.awt.Toolkit
	for i=0 to 10
		oToolkit.keyPress( oKeyEvent_EOL )			REM methods of XToolkitRobot.
		oToolkit.keyRelease( oKeyEvent_EOL )
		oToolkit.keyPress( oKeyEvent_SPACE )			REM methods of XToolkitRobot.
		oToolkit.keyRelease( oKeyEvent_SPACE )
		oToolkit.keyPress( oKeyEvent_DELETE )			REM methods of XToolkitRobot.
		oToolkit.keyRelease( oKeyEvent_DELETE )
	next
end sub

Not an answer, just a note: remember that keyPress/keyRelease are part of an unpublished interface, which is subject to change without notice.