Excel, save just a single worksheet to new XLS file [resolved]
How can I, from within the VBA code, save a single worksheet to a new .XLS file?
I tried the sheet.SaveAs filename method
but it saves the ENTIRE current file, all sheets and macros etc, into the new file.
I just want an XLS file with ONE sheet.
Here's what I'm doing now
Code:
Dim NewSheet As Worksheet
Dim NewSheetName As String
' Copy the original, target sheet to temp so we can operate on it
Worksheets(Original_Sheet_Name).Copy after:=Sheets(Sheets.Count)
Set NewSheet = Worksheets(ActiveSheet.Name)
NewSheet.Name = NewSheetName
(do stuff ...)
NewSheet.SaveAs FileName
Thanks, DaveBo