dear, can someone help out please?

I am unable to save the file. I get following error 1004 document not saved

ActiveWorkbook.SaveAs Filename:=xlsname, FileFormat:=xlOpenXMLWorkbookMacroEnabled, ConflictResolution:=xlLocalSessionChanges
Option Explicit
Sub Upgrade()
Application.DisplayAlerts = False
Dim tempSheet As Worksheet
Dim ws As Worksheet
Dim wb As Workbook
Dim FileToOpen As String
Dim Sheet1 As Worksheet
Dim wb2 As Workbook
Dim total As Integer
Dim xlsname As String

Application.DisplayAlerts = False


Set wb = ActiveWorkbook ' Or ThisWorkbook, or Workbooks("filename.xlsx"), etc.
Set tempSheet = wb.Sheets.Add
Application.DisplayAlerts = False
For Each ws In wb.Worksheets
    Application.DisplayAlerts = False
    If ws.Name <> tempSheet.Name Then
        ws.Delete
    End If
    Application.DisplayAlerts = False
Next

'Now open the other workbook for which the sheets need to be copied:
FileToOpen = Application.GetOpenFilename

If FileToOpen = Empty Then
    MsgBox "No File Specified.", vbExclamation, "ERROR"
    Exit Sub
Else
    Set wb2 = Workbooks.Open(Filename:=FileToOpen)

   For Each Sheet1 In wb2.Sheets
   
        With Sheet1.UsedRange
            Sheet1.Copy after:=wb.Sheets(wb.Sheets.Count)
            End With
    Next Sheet1

End If
'remove tempsheet
tempSheet.Delete

'close copied content file (filetoopen)
wb2.Close

' save generated file as new file
xlsname = Application.GetSaveAsFilename & "xlsm"

Application.DisplayAlerts = False

ActiveWorkbook.SaveAs Filename:=xlsname, FileFormat:=xlOpenXMLWorkbookMacroEnabled, ConflictResolution:=xlLocalSessionChanges

Set wb = ActiveWorkbook
ActiveWorkbook.Close False

End Sub