I have this macro in Excel and need an OpenOffice version. I have put the full macro from excel below:
Code: Select all
Sub Make_Glad_Sheets()
Application.ScreenUpdating = False
Sheets("DUMP").Activate
Dim xRg As Excel.Range
Dim wSh As Excel.Worksheet
Dim wBk As Excel.Workbook
Set xRg = Sheets("DUMP").Range("Glad_list")
Dim xWs As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each xWs In Application.ActiveWorkbook.Worksheets
If xWs.Name <> "Home Sheet" And xWs.Name <> "DUMP" And xWs.Name <> "Reference" And xWs.Name <> "Glad_template" Then
xWs.Delete
End If
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
For Each xRg In Sheets("DUMP").Range("Glad_list")
On Error Resume Next
Sheets("DUMP").Activate
Application.DisplayAlerts = Flase
ThisWorkbook.Sheets(xRg.Value).Delete
Application.DisplayAlerts = True
Next xRg
For Each xRg In Sheets("DUMP").Range("Glad_list")
Sheets("DUMP").Activate
With wBk
Sheets("Glad_template").Copy After:=Sheets(Sheets.Count)
On Error Resume Next
ActiveSheet.Name = xRg.Value
If Err.Number = 1004 Then
Debug.Print xRg.Value & " already used as a sheet name"
End If
On Error GoTo 0
End With
Next xRg
Application.Calculation = xlAutomatic
Application.StatusBar = False ' Clear the status bar in case it isn't blank for any reason
Sheets("Home Sheet").Activate ' Go back to the Home Sheet sheet
Application.ScreenUpdating = True
End Sub
Code: Select all
oSheets = ThisComponent.Sheets
oSheets.copyByName("Glad_template", "TemplateCopy", oSheets.Count)