Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Make adding a footer optional with message box


In my particular application I want our bookkeeper to be prompted to make a
conscious decision to add a footer or not. Following Walkenbach's lead on
p. 539 of his Power
Programming with VBA book, I tried the code below as a class module in
Personal.xls but I couldn't get it to work for all workbooks. It only works
if I manually insert the code in each workbook. In the properties pane for
Personal.xls under Instancing the dropdown box said "2-PublicNotCreatable".
Any ideas about what is wrong? I tried the first line of code with
Excel.Application or Application with no luck.

Do I have to make this an Add-In?

Regards,
Ernie

--------------------------------------------------------------------
Public WithEvents AppEvents As Excel.Application
Private Sub AppEvents_Workbook_BeforePrint(Cancel As Boolean)
Call ErnieAddPath
End Sub
Private Sub ErnieAddPath()
Ans = MsgBox("Add path to footer?", vbYesNo + vbQuestion, "Tell Me")
If Ans = vbNo Then
ActiveSheet.PageSetup.LeftFooter = ""
Else: For Each sht In ThisWorkbook.Sheets
sht.PageSetup.LeftFooter = "&8" & LCase(ThisWorkbook.FullName)
Next sht
End If
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Make adding a footer optional with message box

You have a reply to your earlier post.

"Ernest L. Lippert" wrote:

In my particular application I want our bookkeeper to be prompted to make a
conscious decision to add a footer or not. Following Walkenbach's lead on
p. 539 of his Power
Programming with VBA book, I tried the code below as a class module in
Personal.xls but I couldn't get it to work for all workbooks. It only works
if I manually insert the code in each workbook. In the properties pane for
Personal.xls under Instancing the dropdown box said "2-PublicNotCreatable".
Any ideas about what is wrong? I tried the first line of code with
Excel.Application or Application with no luck.

Do I have to make this an Add-In?

Regards,
Ernie

--------------------------------------------------------------------
Public WithEvents AppEvents As Excel.Application
Private Sub AppEvents_Workbook_BeforePrint(Cancel As Boolean)
Call ErnieAddPath
End Sub
Private Sub ErnieAddPath()
Ans = MsgBox("Add path to footer?", vbYesNo + vbQuestion, "Tell Me")
If Ans = vbNo Then
ActiveSheet.PageSetup.LeftFooter = ""
Else: For Each sht In ThisWorkbook.Sheets
sht.PageSetup.LeftFooter = "&8" & LCase(ThisWorkbook.FullName)
Next sht
End If
End Sub


--

Dave Peterson
Reply
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
Fix this make it an optional feature. Gord Dibben Excel Discussion (Misc queries) 1 November 13th 09 01:02 AM
Tring to save header & footer change causes an error message Anniethefish Excel Discussion (Misc queries) 1 May 20th 09 01:59 PM
Vlookup -Want to make table of array optional Karthik Excel Discussion (Misc queries) 3 November 29th 06 12:47 AM
error message: compile error, argument not optional Pierre via OfficeKB.com Excel Programming 3 September 5th 05 03:45 PM
Make the default always with a Footer hsjj Excel Discussion (Misc queries) 2 January 28th 05 12:41 AM


All times are GMT +1. The time now is 09:49 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"