Ojala alguien pueda ayudarme con este codigo ya que me esta marcando un error 1004:
Sub MakeBackup2()
Dim Archivo$, InvNum$, fn As Variant
Workbooks("CALCULO 2010.xlsm").Activate
ActiveWorkbook.Sheets("Input").Activate
InvNum = Range("S3").Value & ".xlsx"
' Ruta = ActiveSheet.Parent.Path
Archivo = ActiveSheet.Parent.Path & "\Backup\2010\" & Range("S3").Value & ".xlsx"
If Not FileExists(Archivo) Then
MsgBox "The file doesn't exist!"
ActiveWorkbook.Sheets("Input").Copy
ActiveSheet.Shapes("Button 1").Select
Selection.Delete
ActiveSheet.Shapes("Button 2").Select
Selection.Delete
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A8").Select
Application.ActivePrinter = "PDFill PDF&Image Writer on Ne01:"
ExecuteExcel4Macro _
"PRINT(1,,,1,,,,,,,,2,""PDFill PDF&Image Writer on Ne01:"",,TRUE,,FALSE)"
ActiveWorkbook.SaveAs Filename:=Archivo
ActiveWorkbook.Close (True)
Workbooks("CALCULO 2010.xlsm").Activate
Range("S3").Select
Else
MsgBox "The file already exists!" & Chr(13) & "Please, enter a new name"
fn = Application.GetSaveAsFilename(InvNum, "Excel Workbook(*.xlsx),*.xlsx", 1, "Enter the name")
If TypeName(fn) = "Boolean" Then Exit Sub
ActiveWorkbook.SaveAs fn
ActiveWorkbook.Close (True)
Workbooks("CALCULO 2010.xlsm").Activate
Range("S3").Select
End If
End Sub
Me da error en la linea
ActiveWorkbook.SaveAs fn
El error que me da es:
Código:
NOTA: Uso XL 2007."This extension can not be used with the selected file type. Change the file extension in the File name text box or select a different file type by changing the Save as type."
Gracias por su ayuda.