Assuming EditSheet expects a worksheet object, it's not clear from the context...
EditSheet ThisWorkbook.Sheets(SheetName)
But, on re-reading it, nothing is clear.
Which worksheet do you want to edit? What's the code for EditSheet. especially the declaration?
You really should not rely on ActiveWorkbook or ActiveSheet - there are times, probably like now, when it is not clear what the active workbook is.
For example:
Sub OutputN(SheetName As String, n, FilePath, SaveName As String, FileType)
Dim wbA as Excel.Workbook
Dim wsA as Excel.Worksheet
Dim wbB as Excel.Workbook
Set wbA = ThisWorkbook '// No problem with this, it refers to the wb running the code.
Set wsA = wbA.Sheets(SheetName)
'// No need to Activate it
'wsA.Activate
' On Error Resume Next
wsA.Range(SheetName & "_Summary" & n).Copy
'Application.DisplayAlerts = False
Set wbB = Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteValues
If FileType = xlOpenXMLWorkbook Then
EditSheet wsA
'// Or maybe you want
' EditSheet wbB.WorkSheets(1)
End If
wbB.SaveAs Filename:=FilePath & SaveName, _
FileFormat:=FileType, CreateBackup:=False
Bookmarks