Ask Your Question
0

CalcBASIC: How to delete active sheet ?

asked 2019-11-30 11:18:51 +0100

lonk gravatar image

updated 2019-11-30 11:33:27 +0100

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 ?

edit retag flag offensive close merge delete

Comments

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

Schiavinatto gravatar imageSchiavinatto ( 2019-11-30 12:38:28 +0100 )edit

Dear @Mike Kaganski and @Schiavinatto,

Thank you so much for your support.

Khob Khun Krab

lonk gravatar imagelonk ( 2019-11-30 15:40:05 +0100 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2019-11-30 11:58:14 +0100

Hello @lonk

Example:

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

Deletes sheets with isProtected = True property as well.

edit flag offensive delete link more

Comments

Dear @SM_Riga, my life saver,

This is what I'm looking for.

Khob Khun Krab

lonk gravatar imagelonk ( 2019-11-30 15:37:23 +0100 )edit

One-lined code

ThisComponent.Sheets.removeByName(ThisComponent.getCurrentController.getActiveSheet.Name)
lonk gravatar imagelonk ( 2019-12-01 11:18:53 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-11-30 11:18:51 +0100

Seen: 18 times

Last updated: Nov 30