VBE313
03-27-2019, 07:34 AM
The bold and underlined line is the error I am getting. Run-time error '1004' Method 'SaveAs' ofobject'_Workbook' failed
Dim path1 As String
Dim Filename1 As String
Dim filestring As String
filestring = path1 & Filename1
Application.ScreenUpdating = False
path1 = ActiveSheet.Range("I7").Text
Range("A1:f40").Select
Selection.Copy
Sheets("Laser").Select
Sheets.Add After:=ActiveSheet
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
ActiveSheet.Select
ActiveSheet.Move
Filename1 = Range("B4").Text
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=filestring & ".xlsx", FileFormat:=xlOpenXMLWorkbook
Application.DisplayAlerts = True
ActiveWorkbook.Close
Application.ScreenUpdating = True
Sheets("Laser").Select
End Sub
Dim path1 As String
Dim Filename1 As String
Dim filestring As String
filestring = path1 & Filename1
Application.ScreenUpdating = False
path1 = ActiveSheet.Range("I7").Text
Range("A1:f40").Select
Selection.Copy
Sheets("Laser").Select
Sheets.Add After:=ActiveSheet
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
ActiveSheet.Select
ActiveSheet.Move
Filename1 = Range("B4").Text
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=filestring & ".xlsx", FileFormat:=xlOpenXMLWorkbook
Application.DisplayAlerts = True
ActiveWorkbook.Close
Application.ScreenUpdating = True
Sheets("Laser").Select
End Sub