macro for footer

  • Thread starter Thread starter april
  • Start date Start date
A

april

on each excel document that i print, i would like to include the date, the
file name, and the path. i saw a solution to this but the solution pertained
only to new documents. how do i set up a macro in an existing document that
automatically prints that info?

thanks for your help
 
This code should do what you need. Right click the XL icon in the upper left
hand corner of the XL window and select View code. This will take you to the
VBE. Paste the following...

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wks As Worksheet

For Each wks In ActiveWindow.SelectedSheets
With wks.PageSetup
.LeftFooter = ThisWorkbook.Path & "\" & ThisWorkbook.Name
.RightFooter = Date
End With
Next wks
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top