puts the filename in the right footer
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim myWorksheet As Worksheet
Dim sFileName As String
Dim sCompanyName As String
sCompanyName = Worksheets("Profit").Range("A1").Value
sFileName = "&F" 'Code generating file name
For Each myWorksheet In ThisWorkbook.Worksheets
With myWorksheet.PageSetup
.LeftFooter = sCompanyName
.CenterFooter = ""
.RightFooter = sFileName
End With
Next myWorksheet
End Sub
Related examples in the same category