Hello,

Trying to use following code in excel 2010:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
    Dim sht As Object
    
    For Each sht In ThisWorkbook.Sheets
            With sht.PageSetup
                .PrintTitleRows = ""
                .PrintTitleColumns = ""
                .LeftHeader = "&Z"
                .CenterHeader = "&F"
                .LeftFooter = "by xxxx"
            End With
    Next sht
                
End Sub
I cannot get it functioning. Please guide me.