W
wjgreen
I found the macro below quite awhile ago on this site and have bee
using it ever since. It's great! However, it does not always
automatically place the information on every sheet of the workbook
(Sometimes) I have to manually go to each page and do a Print Preview
THEN the info appears on my printout and is updated automatically.
Am I missing a step??
Thanks.
++++++++++++++++++++++++++++++++++++++++++
Using a macro to add information to each sheet printed from th
workbook in Microsoft Excel
--------------------------------------------------------------------------------
Add a macro command that will automatically cause information
including the path, to appear on each sheet you print from th
workbook. When using this technique, the full path for where you save
the workbook will be printed in Excel 97 and 2000.
Open the VBE macro editor, and press Alt+F11.
In the Project Explorer, double-click the ThisWorkbook module.
Add an event called Workbook_BeforePrint.
In the event, type code as follows:
Private Sub Workbook_BeforePrint(Cancel as Boolean)
ActiveSheet.PageSetup.LeftFooter="&A&F&T&D" & ActiveWorkbook.Path
End Sub
The letters A, F, T, D = the name of the sheet, name of the workbook
time and date.
In Excel 2002, the middle line of code will be shorter:
.LeftFooter=="&A&F&T&D"&Z"
Save the file
using it ever since. It's great! However, it does not always
automatically place the information on every sheet of the workbook
(Sometimes) I have to manually go to each page and do a Print Preview
THEN the info appears on my printout and is updated automatically.
Am I missing a step??
Thanks.
++++++++++++++++++++++++++++++++++++++++++
Using a macro to add information to each sheet printed from th
workbook in Microsoft Excel
--------------------------------------------------------------------------------
Add a macro command that will automatically cause information
including the path, to appear on each sheet you print from th
workbook. When using this technique, the full path for where you save
the workbook will be printed in Excel 97 and 2000.
Open the VBE macro editor, and press Alt+F11.
In the Project Explorer, double-click the ThisWorkbook module.
Add an event called Workbook_BeforePrint.
In the event, type code as follows:
Private Sub Workbook_BeforePrint(Cancel as Boolean)
ActiveSheet.PageSetup.LeftFooter="&A&F&T&D" & ActiveWorkbook.Path
End Sub
The letters A, F, T, D = the name of the sheet, name of the workbook
time and date.
In Excel 2002, the middle line of code will be shorter:
.LeftFooter=="&A&F&T&D"&Z"
Save the file