Table of Contents

Create a Footer Before Printing

Below we will look at a program in Excel VBA that creates a footer before printing a workbook.

Create a Workbook BeforePrint Event. Code added to the Workbook BeforePrint Event will be executed by Excel VBA before you print a workbook.

1. Open the Visual Basic Editor.

2. Double click on This Workbook in the Project Explorer.

3. Choose Workbook from the left drop-down list. Choose BeforePrint from the right drop-down list.

Workbook BeforePrint Event in Excel VBA

4. To create a footer add the following code line to the Workbook BeforePrint Event:

ActiveSheet.PageSetup.LeftFooter = ActiveWorkbook.FullName

Note: The PageSetup object contains all page setup attributes (left footer bottom margin paper size left margin and so on) as properties.

5. Test the program by printing your workbook.

Result:

Footer

Leave A Comment

Excel meets AI – Boost your productivity like never before!

At Formulas HQ, we’ve harnessed the brilliance of AI to turbocharge your Spreadsheet mastery. Say goodbye to the days of grappling with complex formulas, VBA code, and scripts. We’re here to make your work smarter, not harder.

Related Articles

The Latest on Formulas HQ Blog