Here is my Macros to print all worksheet names in a Calc:
Sub ListSheetNames()
Dim oDoc As Object
Dim oSheets As Object
Dim i As Integer
Dim sSheetName As String
oDoc = ThisComponent
oSheets = oDoc.Sheets
For i = 0 To oSheets.Count - 1
sSheetName = oSheets.getByIndex(i).Name
Debug.Print sSheetName
Next i
End Sub
How to fix it?