Assign filename to pdf from cell value
问题 I have a macro that saves the excel file into a PDF one: Sub PDF() ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _ Filename:="C:\Report.pdf", _ OpenAfterPublish:=False End Sub How do I assign the pdf name to a value in a specific cell in excel? And how I do specify the save directory as the same where the excel file is located? 回答1: If you modify your code like below, your ActiveSheet will get exported as a .PDF to the same folder as the ActiveWorkbook , and with the name defined in cell