E
Ernest L. Lippert
I would like to put the code below somewhere so that it will be activated
every time a worksheet is viewed or printed. I have tried putting it in a
module in my Private.xls workbook but since I don't call it in a procedure,
it doesn't work like I want. The only way it works is if I put it into the
code behind each of the workbooks in use.
I have a particular need to have our bookkeeper the put the path name on
all the worksheets except in those instances where it is sent as a pdf or
xls
file for inclusion in other documents. In those instances the footer needs
to be consciously removed. If I can cajole Excel to use this code, it will
keep our church administrator much happier.
Regards,
Ernie Lippert
------------------------------------------------------
Option Explicit
Sub Workbook_BeforePrint(Cancel As Boolean)
Call ErnieAddPath
End Sub
Sub ErnieAddPath()
Dim Ans As XlYesNoGuess
Ans = MsgBox("Add path to footer?", vbYesNo + vbQuestion, "Tell Me")
If Ans = vbNo Then
ActiveSheet.PageSetup.LeftFooter = ""
Else: ActiveSheet.PageSetup.LeftFooter = "&8" &
LCase(ThisWorkbook.FullName)
End If
End Sub
every time a worksheet is viewed or printed. I have tried putting it in a
module in my Private.xls workbook but since I don't call it in a procedure,
it doesn't work like I want. The only way it works is if I put it into the
code behind each of the workbooks in use.
I have a particular need to have our bookkeeper the put the path name on
all the worksheets except in those instances where it is sent as a pdf or
xls
file for inclusion in other documents. In those instances the footer needs
to be consciously removed. If I can cajole Excel to use this code, it will
keep our church administrator much happier.
Regards,
Ernie Lippert
------------------------------------------------------
Option Explicit
Sub Workbook_BeforePrint(Cancel As Boolean)
Call ErnieAddPath
End Sub
Sub ErnieAddPath()
Dim Ans As XlYesNoGuess
Ans = MsgBox("Add path to footer?", vbYesNo + vbQuestion, "Tell Me")
If Ans = vbNo Then
ActiveSheet.PageSetup.LeftFooter = ""
Else: ActiveSheet.PageSetup.LeftFooter = "&8" &
LCase(ThisWorkbook.FullName)
End If
End Sub