CalcBASIC: How to delete active sheet?

From the code:

ThisComponent.getCurrentController.getActiveSheet

How can I delete this active sheet ?

And if the active sheet was locked, how can I delete this locked active sheet ?

https://forum.openoffice.org/en/forum/viewtopic.php?f=9&t=94233

Sub RemoveByNamePlanS ( X As String)
'================================================|
thisComponent.getSheets.RemoveByName( X )
End Sub

Dear @mikekaganski and @schiavinatto,

Thank you so much for your support.

Khob Khun Krab

Hello @lonk

Example:

oSheet = ThisComponent.getCurrentController.getActiveSheet
sName = oSheet.Name
ThisComponent.Sheets.removeByName(sName)

Deletes sheets with isProtected = True property as well.

Dear @SM_Riga, my life saver,

This is what I’m looking for.

Khob Khun Krab

One-lined code

ThisComponent.Sheets.removeByName(ThisComponent.getCurrentController.getActiveSheet.Name)