Good morning all,
I have come across 'Run-time error '1004': - Method 'SaveAs' of object '_Workbook' failed.
The code is below. Any help would be greatly appreciated.
Many thanks,
I have come across 'Run-time error '1004': - Method 'SaveAs' of object '_Workbook' failed.
The code is below. Any help would be greatly appreciated.
Many thanks,
Code:
Sub SaveAsPDFExcel()
Dim fName As String
Dim sLoc As String 'location
sLoc = "I:\FST\Quality\Non-Conformance\Non-Conformance Reports\Open\"
Sheets(Array("NCR", "RCA")).Select
With ActiveSheet
fName = .Range("L4").Value & "-" & .Range("E6").Value
'Save as xlsx
ActiveWorkbook.SaveAs Filename:=sLoc & fName, FileFormat:=xlOpenXMLWorkbookMacroEnabled
.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
sLoc & fName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End With
End Sub
Last edited: