Thank you for the opportunity to help you with your question!
Put this code in the personal workbook:
'workbook Book1.xlsx must already be open
'and it must have already been saved to disk
'so that it contains file path information as
'part of its name.
'That workbook must have sheets named
'Sheet1, Sheet3, Sheet4 and Sheet6 in it.
'Sheet1 must have a valid filename in cell A1.
Dim FilePath As String
Dim NewName As String
FilePath = Left(ActiveWorkbook.FullName, _
NewName = ActiveWorkbook.Worksheets("Sheet1").Range("A1")
Sheets(Array("Sheet3", "Sheet4", "Sheet6")).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
FilePath & NewName & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, _
[Edit] I didn't code in the addition of the 20 suffix in the name
above, you could accomplish that by changing one line of the code above
NewName = ActiveWorkbook.Worksheets("Sheet1").Range("A1") & "20"
Please let me know if you need any clarification. I'm always happy to answer your questions.
15 Million Students Helped!
Sign up to view the full answer