+ Reply to Thread
Results 1 to 13 of 13

Assigning Footers in VBA - What is going on here?

  1. #1
    Registered User
    Join Date
    01-08-2014
    Location
    Scunthorpe, North Lincs, England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Question Assigning Footers in VBA - What is going on here?

    I am really confused by this???

    The following code performs page setup on the active sheet; I am trying to obtain:

    Left footer = worksheet tab name (in this example assume this to be "Bruce Jennings")
    Centre footer = Page x (where x is the page no)
    Right footer = Printed on dd-mm-yyyy

    when I run this code as it is (i.e. the Stops remarked out) this is the result:

    Left footer is blank (incorrect)
    Centre footer is "Page&LBruce Jenni" (incorrect)
    Right footer is Printed on 09-01-2014 (correct)

    With me so far...

    Now then... When I run the code with the Stops included and continue after each break I obtain the desired left, centre and right footers

    What is going on here???


    Please Login or Register  to view this content.
    This is really confusing...

    Any help (of the psychiatric kind if not Excel) would be gratefully received...
    Last edited by Fotis1991; 01-09-2014 at 12:51 PM.
    Kind regards

    The Saint

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,414

    Re: Assigning Footers in VBA - What is going on here?

    Hi,

    Can you use code tags in your code...?
    Honestly, not sure why it does work.
    Here's a code that I use without any problem.

    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,414

    Re: Assigning Footers in VBA - What is going on here?

    And here's a code adjusting the print area as per your code :

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-08-2014
    Location
    Scunthorpe, North Lincs, England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Assigning Footers in VBA - What is going on here?

    Thx, GC Excel, I will try your code although I did start out using tags and got similarly bad results!

    What does the Screenupdating switch do?

  5. #5
    Registered User
    Join Date
    01-08-2014
    Location
    Scunthorpe, North Lincs, England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Assigning Footers in VBA - What is going on here?

    Hi GC Excel

    I have just tried your code (just substituting the left, centre and right footer lines) and the result??? - Not pretty:

    Left footer is "Bruce Jen" (incorrect)
    Centre footer is "Printed on" (incorrect)
    Right footer is "Page" (incorrect)

    It's as if there is not enough room for the footer text to be placed in the margins for each of the left, centre and right footers?

    Gulp!

    NB - I know what the Screenupdating switch does now - thx...
    Last edited by TheSaint0001; 01-09-2014 at 10:30 AM.

  6. #6
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,414

    Re: Assigning Footers in VBA - What is going on here?

    Can you share your file so I can test?

  7. #7
    Registered User
    Join Date
    01-08-2014
    Location
    Scunthorpe, North Lincs, England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Assigning Footers in VBA - What is going on here?

    I could - how do I do that? (I'm new!)

  8. #8
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,414

    Re: Assigning Footers in VBA - What is going on here?

    Click on the "Go Advanced" button and then you will have the option to attach a file (by clicking on the icon next to the happy face !)

  9. #9
    Registered User
    Join Date
    01-08-2014
    Location
    Scunthorpe, North Lincs, England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Assigning Footers in VBA - What is going on here?

    You are not going to believe this but I ran the revised code (see above) but with Stops in-between each footer line and guess what - it works!

    I obviously cannot leave the Stops in the final code; something mysterious is happening to Excel???

    Area 51 looms ever nearer!!!

  10. #10
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,414

    Re: Assigning Footers in VBA - What is going on here?

    Hmmmm...
    Can you try this one :

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    01-08-2014
    Location
    Scunthorpe, North Lincs, England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Assigning Footers in VBA - What is going on here?

    GC Excel - you are a wizard - this works!!

    Why it works I have absolutely no idea but the footers are now correct in my worksheet

    Just one concern - Does Printercommunication interfere with anything else???

    Your patience and help is greatly appreciated!

  12. #12
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,414

    Re: Assigning Footers in VBA - What is going on here?

    Hi Simon,

    The PrintCommunication setting can be used to "accelerate" the code.
    When set to false it will be faster but it will NOT work for the header / footer. That is a known bug with Excel.
    So what you can do is set PrintCommunication = False to change all setting EXCEPT the header / footer.
    Then set it to True to modify the header/footer

    This is the compromise between speed and a code that works.

    Thanks for the rep and cheers !

  13. #13
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Assigning Footers in VBA - What is going on here?

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. In order to put code tags, either type
    Please Login or Register  to view this content.
    at the end of it, OR you can highlight your code and click the # icon at the top of your post window.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help need understanding footers
    By gigahacker in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-15-2013, 08:36 PM
  2. Footers
    By vandest1 in forum Excel General
    Replies: 4
    Last Post: 04-30-2009, 11:47 AM
  3. FOOTERS
    By rachel@cpa in forum Excel General
    Replies: 2
    Last Post: 03-02-2005, 02:06 PM
  4. Footers
    By rachel@cpa in forum Excel General
    Replies: 2
    Last Post: 02-24-2005, 03:06 PM
  5. Footers
    By Aurora in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-11-2005, 12:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1