sub leheLisamine Dim Doc As Object Dim Sheet As Object Doc = StarDesktop.CurrentComponent Sheet = Doc.Sheets(0) If Doc.Sheets.hasByName("MySheet") Then Sheet = Doc.Sheets.getByName("MySheet") Else Sheet = Doc.createInstance("com.sun.star.sheet.Spreadsheet") Doc.Sheets.insertByName("MySheet", Sheet) End If end sub