LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Make a macro availiable to all workbooks

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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I make several workbooks work together? Elisabeth New Users to Excel 3 December 28th 09 03:57 PM
make severaly workbooks 1 Steve[_71_] Excel Programming 1 December 6th 04 05:40 PM
make severaly workbooks 1 Steve[_71_] Excel Programming 1 December 6th 04 05:40 PM
How to make a macro available to all the workbooks? kd Excel Programming 1 November 28th 04 09:16 AM
Make Macro available to all new workbooks Kirk P. Excel Programming 3 June 11th 04 06:53 PM


All times are GMT +1. The time now is 06:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"