To add the macro

1. Press <Alt+F11> to open the Visual Basic Editor.

2. In the Project pane, double-click the ThisWorkbook module to open it.

3. Two drop-down lists, General and Declarations, appear at the top of the module sheet (the right pane). From the General drop-down list, select Workbook.

4. From the drop-down list on the right, select Workbook_BeforePrint.

5. In the module sheet, type the following code:

Private Sub Workbook_BeforePrint (Cancel As Boolean) ActiveSheet.PageSetup.LeftFooter = _ "&A&F&T&D " & ActiveWorkbook.Path. End Sub

The letters A, F, T and D are the worksheet name, workbook name, time and date, respectively.

In Excel 2002 and later, the middle line of code will be shorter: "£A£F£Z£T£D,r

6. Save the file.

0 0

Post a comment