Hi - I'm trying to copy sheets not named Sheet1/2/3 to a new workbook and then prompt the user to save it. This is the code I'm using.
Code:
Sub ExportFile()
Application.ScreenUpdating = False
Dim DstFile As String
Dim TD As String
TD = Format(Date, "mm-dd-yyyy")
Dim wb As Workbook
Set wb = Workbooks.Add
Dim wks As Worksheet
For Each wks In Worksheets
If wks.Name <> "Sheet1" Or wks.Name <> "Sheet2" Or wks.Name <> "Sheet3" Then
wks.Copy Before:=wb.Sheets(wb.Sheets.Count)
End If
Next
DstFile = Application.GetSaveAsFilename _
(InitialFileName:="New File" & " " & TD & ".xls", _
Title:="Save As")
If DstFile = "False" Then
MsgBox "File not Saved, Actions Cancelled."
Exit Sub
Else
wb.Close
End If
MsgBox ("File Saved")
Application.ScreenUpdating = True
End Sub