Mauro, o código completo, salva mas não abre.
Sub Salvar()
Application.ScreenUpdating = 0
Dim Pasta As String
Application.DisplayAlerts = False
template_file = ActiveWorkbook.FullName
fileSaveName = "Desktop" + VBA.Strings.Format(Now, "dd-mm-yyyy") + ".xlsm"
fileSaveName = Application.GetSaveAsFilename(InitialFileName:="DLista Reserva" + VBA.Strings.Format(Now, "dd-mm-yyyy") + ".xlsm", fileFilter:="Excel Files (*.xlsm), *.xlsm")
Dim newBook As Workbook
Dim plan As Worksheet
Dim Intervalo As Range
Set Intervalo = [DB16]
Set newBook = Workbooks.Add
ThisWorkbook.Activate
Intervalo.Copy
newBook.Sheets(1).[A1].PasteSpecial xlPasteValues
For i = newBook.Sheets.Count To 2 Step -1
newBook.Sheets(i).Delete
Next
newBook.SaveAs Filename:=fileSaveName, FileFormat:=xlTextWindows, CreateBackup:=False
newBook.Close SaveChanges:=True
Set newBook = Nothing
Application.ScreenUpdating = 1
End Sub
Postado : 22/05/2015 5:02 pm