#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Footer

Hello

When using the following code in a BeforePrint subroutine, the footer is
not being updated, although the code runs without error:

With ActiveSheet.PageSetup
.LeftFooter = "&05" & strA & strC & strB & strS _
& Chr(10) & strFN
End With

What goes wrong?

Regards,
Walter Hofmann

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Footer

There is nothing wrong with the code per se. Are the variables, "strA",
etc. visible to this module? I'd guess not. If you put an "Option
Explicit" at the top of this module (and every module by selecting "Require
variable declaration" under Tools, Options, Editor in the VBE, that's what
the pros do), this problem would pop up immediately as an error.

If strA, etc. is defined in another module you have to declare them as
Public at the top of their module.

--
Jim Rech
Excel MVP


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Footer


Dear Jim

All str variables are defined in the subroutine and there is an option
explicit.

When I trace the code, the contents of the variables are correct, it's
just the assignment to the .footer that doesn't work.

Walter


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Footer

Hmmm.. Does a slightly dumbed down version work?

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftFooter = "abc"
End Sub

--
Jim Rech
Excel MVP


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Footer

The problem was that the code for the footer was in the BeforeSave
subroutine, which I called from the BeforePrint subroutine. I now have
made a 3rd subroutine which is being called from both BeforePrint and
BeforeSave. Like this all works as expected.

Walter

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Footer Fuzzy Excel Discussion (Misc queries) 2 November 6th 08 11:57 PM
Excel footer to look like Word footer? Carole O Excel Discussion (Misc queries) 5 June 2nd 08 11:25 PM
Footer in XL Andre Excel Worksheet Functions 4 October 7th 06 06:51 PM
Footer nc Excel Discussion (Misc queries) 7 April 24th 06 09:41 AM
Footer Fuad Excel Worksheet Functions 1 October 4th 05 12:12 AM


All times are GMT +1. The time now is 06:43 AM.

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

About Us

"It's about Microsoft Excel"