Hi,
I have 2 pieces of code I would like to put into one so that 2 of the worksheets save in one folder, whilst the other saves in a different folder.
Problem is, I would like to run this from one button and it doesn't work running both of these from the same button.
Code as follows:
Many thanks,
I have 2 pieces of code I would like to put into one so that 2 of the worksheets save in one folder, whilst the other saves in a different folder.
Problem is, I would like to run this from one button and it doesn't work running both of these from the same button.
Code as follows:
Code:
Sub SaveAsClosed()
Dim fName As String
Dim sLoc As String 'location
sLoc = "I:\FST\Quality\Non-Conformance\Non-Conformance Reports\Open\Closed\"
' Select both sheets to export into PDF file
Sheets(Array("NCR", "RCA")).Select
With ActiveSheet
fName = .Range("L4").Value & "C" & "-" & .Range("E6").Value
'Save as xlsm
ActiveWorkbook.SaveAs Filename:=sLoc & fName, FileFormat:=xlOpenXMLWorkbookMacroEnabled
' Export to the PDF
.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
sLoc & fName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
' Unselect the group (select only one sheet)
.Select
End With
End Sub
Sub SaveCustomerCopyClosed()
Dim fName As String
Dim sLoc As String 'location
sLoc = "I:\FST\Quality\Non-Conformance\Non-Conformance Reports\Customer Copy Non-Conformance Report\"
' Select both sheets to export into PDF file
Sheets(Array("CUSTOMER COPY")).Select
With ActiveSheet
fName = .Range("L4").Value & "C" & "-" & .Range("E6").Value
'Save as xlsm
ActiveWorkbook.SaveAs Filename:=sLoc & fName, FileFormat:=xlOpenXMLWorkbookMacroEnabled
' Export to the PDF
.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
sLoc & fName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
' Unselect the group (select only one sheet)
.Select
End With
End Sub
Many thanks,