Add file name automatically in the vba code ...
How can I add the file name automatically in the Excel VBA code?
ActiveSheet.Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$AE$40"
ActiveSheet.PageSetup.Orientation = xlPortrait
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="\\D:\MDH_Data\Delivery Notes\Print_DeliveryNote_001.pdf", Quality:=xlQualityStandard, IgnorePrintAreas:=False
Note: Print_DeliveryNote_001.pdf. This file name should be taken automatically from DeliveryNote.xlsx Cell "D4" and put in the below code line.
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="\\D:\MDH_Data\Delivery Notes\Print_DeliveryNote_001.pdf", Quality:=xlQualityStandard, IgnorePrintAreas:=False
|