You can dictate the naming convention of a file and have a macro save it automatically
- It can be saved in a specific location
- It can be date stamped
- It can be saved in a specific format
There are 2 examples below
- PDF based on pivot table filter
- Save workbook in a specified location as xlsx and date stamp it
PDF Based On Pivot Table Filter
- This will save the active worksheet in a specified location as a PDF.
- Please note: cell C3 is the pivot table filter
Sub SaveAsPdf()
Dim Val As String
Val = ActiveSheet.Range("C3").Value
ActiveSheet.Name = Val
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:="C:\Users\rossautomatedsolutions\Desktop\" & Val & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
End Sub
Save Workbook In Specified Location As
xlsx With Date Stamp
Sub SaveAsExcel()
ActiveWorkbook.CheckCompatibility = False
ActiveWorkbook.SaveAs Filename:= _
"FULL FILE PATH & NAME" & Format(Date, "mm.dd.yyyy") & ".xlsx" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub