Results 1 to 14 of 14
  1. #1
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Odd Hdr/ftr Behavior (2000 SR1)

    Has anyone noticed some odd behavior with headers and footers in Word 2000 SR1?

    I've been going back and forth across a 2-section document, turning on and off the checkboxes for 1st Page and Diff Odd/Even. I started with a blank document, added 3 pages of text, added a sec break next page, and added 3 more pages of text.

    I make sure that Same As Previous (SAP) is turned off in my headers (didn't deal with footers).

    I can make a change to the settings for 1st Page and Diff Odd/Even in Sec 1. I make sure these apply to This Section only. Then moving forward to the next section, I see that my headers (in terms of having a 1st Page and Diff Odd/Even) in Sec 2 may change.

    I've checked the MSKB and didn't see anything (altho I may have missed an article). Likewise, didn't see anything here since last Sept.

    Some VBA code just to check how many headers there are reveals, with a totally brand new document, that Word thinks there are 3 headers in a section, even tho only 1 "exists". I noticed my brand new document had no header until after the first check of "If oHead.Exists"; now there's a header with a blank para.

    The code (lifted from the Lounge) is:

    <pre> Option Base 1
    Sub RemoveHeadAndFoot()
    Dim oSec As Section
    Dim oHead As HeaderFooter
    Dim oFoot As HeaderFooter
    'Dim hfinfo(2, 2) As Integer
    Dim i As Integer, j As Integer, k As Integer
    'i counts passes thru oSec loop
    'k counts passes thru oHead loop
    'j counts passes thru oHead.Exists test
    i = 0

    For Each oSec In ActiveDocument.Sections
    i = i + 1
    j = 0
    k = 0
    For Each oHead In oSec.Headers
    k = k + 1
    If oHead.Exists Then
    j = j + 1
    oHead.Range.Delete
    End If
    Next oHead
    'hfinfo(i, 1) = j
    Next oSec


    End Sub
    </pre>


    TIA

    Fred

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Odd Hdr/ftr Behavior (2000 SR1)

    Fred

    The three headers and footers exist for each section. They may not be displayed but they do still exist. This makes them a great place for painful metadata to hide. <img src=/S/aflame.gif border=0 alt=aflame width=16 height=16>

    Your oHead.exists has to be true otherwise the For loop above it wouldn't have found it. In terms of logic the code is saying put together a basket of existing things and then check whether those things exist. The fact that it appears to be adding a return that didn't appear before is interesting though.

    When I set up a document for Odd and Even (in Word 97) then that appears to run through the entire document although the First page setting does stick with the section. This is probably by design although it appears from the dialog that odd and even can be set on a section by section basis.

    I've learnt a couple of new things from your post but I don't think I can solve any of the issues you have other than to recommend you don't try to fight this one. I suspect you are not going to be able to get the control you want as Word appears to have these things coded in.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Odd Hdr/ftr Behavior (2000 SR1)

    Hi Fred:
    I'm wondering what kind of changes you're making & how they are showing up in the next section. I do know that it's easy to get confused as to what section you're in (at least I can get confused) because the type of section is listed in the preceding section break & the formatting of the section is controlled by the subsequent break. And of course, the formatting of the last section is controlled by the last paragraph mark. It's enough to make your head swim. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Odd Hdr/ftr Behavior (2000 SR1)

    Hi Andrew,

    Thanks for the response. Here are some more ramblings on the subject.

    Of course, all of this is in preparation for a session I'm doing Monday night on headers/footers across sections. It seems weird and not how I recall this in other versions of Word prior to 2000. I recall in Word 97 (95?) that you could change the "diff 1st page h/f" and the "diff odd/even h/f" independently w/o affecting any other section (assuming you unchecked Same As Previous before making any changes).

    I think I understand the code even tho I liberated it from some post on the Lounge. But things still don't make sense. I did a little more experimenting. Here are some observations and more questions (with some answers).

    1. The para mark is added after the execution of the oHead.Range.Delete statement on the first pass thru the oHead loop. Some header must exist prior to that point for the Delete statement to work (and make the header visible).

    2. The For each oHead statement is executed 3 times but the "If oHead.Exists" is executed once (can see this by the values of k and j). What 3 headers are in the section? If a "first" header existed per above, why didn't other headers "exist"? Theoretically, there are 4 types of headers (buckets where I can have stuff):
    - a plain "Header" that would pertain to all pages of the section [in the absence of a 1st page and diff odd/even headers] or [with a 1st page header and no diff odd/even]
    - a 1st page header if the appropriate page setup layout is checked
    - an even page header if the appropriate page setup layout is checked
    - an odd page header if the appropriate page setup layout is checked

    So something seems even strange that the loop is executed 3 times and not 4 times or 1 time. Also in recording a macro to add text to the various headers, I saw a statement like
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    Other alternatives for the right side of the = included (as far as headers go):
    -wdSeekEvenPagesHeader
    -wdSeekFirstPageHeader
    -wdSeekPrimaryHeader

    Where is the OddpagesHeader?

    ----
    From your email:
    >Your oHead.exists has to be true otherwise the For loop above it wouldn't have found it. In terms of logic the code is saying put together a basket of existing >things and then check whether those things exist.
    OK. If the "For Loop" found it, why didn't the "If" test find the 2nd and 3rd headers?

    OK. I think I answered some of the above. If I create some unique text in the odd-page header and then uncheck both the "diff 1st page h/f" and the "diff o/e page h/f", the text of my odd-page header is the only header. If I now re-check both "diff 1st..." and "diff o/e", the "only-header" text is restored to the odd-page header (and the other text for the 1st-page and even-page header re-appears; it wasn't deleted). It may also explain why the odd-page header is the first one deleted by the macro (followed by the 1st page header and then the even page header). So maybe there is always at least 1 header (the Primary one) even if you never did anything with it.

    >When I set up a document for Odd and Even (in Word 97) then that appears to run through the entire document although the First page setting does stick >with the section. This is probably by design although it appears from the dialog that odd and even can be set on a section by section basis.

    In Word 97, can you set headers and footers independently in each section w/o affecting what other sections have in terms of h/f?

    >as Word appears to have these things coded in

    suggests there is some rational that if you make changes to the combination of h/f in 1 section, there is some rule as to what other sections will end up with in terms of what they had before the change and what they have after the change. Hmmmmm
    ----

    Also, I didn't see any property of oHead that would identify the type of header.

    Now here's some more weird stuff, building on the weirdness of above:
    - create a new document with 3 pages, check diff 1st and diff odd/even
    - run the macro and get k=3, j=3 as expected (so far so good)
    Add a "next page" section break and nothing else
    - run the macro again
    --- get k=3, j=3 for 1st section
    --- get k=3, j=3 for 2nd section
    Maybe that's following the rule that the new section inherited the "properties" of the 1st section, including the 3 fanthom headers?

    Now add 3 pages to 2nd section and remove Same As Previous for all headers (1st page, odd page, even page). Change sec1 so it has "diff 1st page h/f" unchecked and "diff o/e page h/f" unchecked; ie, sec 1 only has 1 header (although they probably all are in the document but don't exist?). Now sec 2 has a "diff 1st page h/f" but does NOT have "diff o/e page h/f" (ie, it has same h/f for all pages after the 1st page of sec 2.

    Strange but it's beginning to make some sense (or it's getting late).

    Fred

  5. #5
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Odd Hdr/ftr Behavior (2000 SR1)

    Hi Phil,

    See the post I just sent back to Andrew. Yours came in while I was finishing it up.

    To keep my sanity, I used the following text in the various h/f's:
    1f=header for section 1, 1st page header
    1o=header for section 1, odd page header
    1e=guess...
    2f=etc.

    The section break was a next-page break. Might be fun if they were odd page or even page breaks. Therefore, I didn't have to look at the section break to know where I was. Just the header or the page number was sufficient (each sec was exactly 3 pages).

    Fred

  6. #6
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Odd Hdr/ftr Behavior (2000 SR1)

    Fred

    You have done much more research on this topic than I have so I don't have a great deal to add here other than.

    I am intrigued by the .exists returning false in the code. It does this in Word 97 too.

    There is no OddpagesHeader as it does double duty depending on whether odd pages is ticked. The header footer index constants are
    wdHeaderFooterEvenPages, wdHeaderFooterFirstPage, or wdHeaderFooterPrimary

    Microsoft's help in Word 97 seems to allude that the Odd pages is a document wide property rather than a Section specific one when you see the following code cut from the help file. This is consistent with what you are seeing.
    <pre>This example creates different headers and footers for odd-numbered pages
    and even-numbered pages in Document1.
    Set myDoc = Documents("Document1")
    myDoc.PageSetup.OddAndEvenPagesHeaderFooter = True
    With myDoc.Sections(1)
    .Headers(wdHeaderFooterPrimary).Range.InsertAfter "Odd Header"
    .Headers(wdHeaderFooterEvenPages).Range.InsertAfte r "Even Header"
    End With</pre>

    In response to your question
    In Word 97, can you set headers and footers independently in each section w/o affecting what other sections have in terms of h/f?
    Yes I can, and I can do it in Word 2000 as well. What I can't do is make one section double sided and others single sided.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  7. #7
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Odd Hdr/ftr Behavior (2000 SR1)

    Hi Andrew,

    I'm surprised to hear that you were able to change h/f in a section without affecting the h/f in other sections. I called a friend who has Word 97 on her machine. We went thru the following and she got the same results as me, which showed the changes are not independent. Don't know what SR of 97 she was running.

    1. start a new document

    2. using TNR at 12 point (to ensure filling 3 pages), type
    =rand(20,10)
    and hit enter; this will fill 3 pages, at least in American English (actually 2-1/2 but we just want text on the 3rd page)

    3. go to page setup and set "diff 1st page" and "diff odd/even" to be checked. Enter some text into each header. (Per email to Phil, using "1f" for sec1, 1st page; "1e" for sec1, even page, etc. is sufficient to maintain sanity.)

    4. Insert Section Break Next page

    5. type
    =rand(20,10
    and hit enter

    6. Sec 2 should also have a diff 1st page header and diff odd/even headers as inherited from the 1st sec when the Section Break was added.

    7. Goto each of the headers in Sec 2 and undo the Same as Previous. Also add text to each header as 2f, 2o, 2e.

    8. go to sec 1 and page setup. Set "diff 1st page" to be unchecked and "diff odd/even" to be unchecked. Result was that sec2 has a different 1st page header (should still see the "2f" text) but does NOT have diff odd/even (ie, all pages past the first one of sec 2 have the same header)

    9. go to sec 2. Change headers so that "diff 1st page" is checked and "diff odd/even" is checked. Now sec 1 has "diff 1st page" unchecked while "diff odd/even" is checked.

    Another oddity using ending point per above:
    1. go to the last page of doc (in sec 2) and enter the header. Click the "Show Previous" button to go thru all the sec 2 headers. No problem.
    2. when click on "Show Previous" again, first sec 1 header encountered is "odd page header" on page 3. This is OK. But try clicking "Show Previous" one more time and you go no where, even though there is an "even page header" on page 2. If you click "Show Next" while still on the "odd header" on page 3, you see the "even header" on page 2. "

    So there's something odd (not obvious) about how odd headers (and footers presumably) are handled.


    Fred

  8. #8
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Odd Hdr/ftr Behavior (2000 SR1)

    Hi Fred:
    I followed your instructions & get the same results as you exactly, using Word 2000. I have no explanation other than it's a bug. I haven't searched the knowledge base yet. Will try to in a few days. If you find anything first, post back.

  9. #9
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Odd Hdr/ftr Behavior (2000 SR1)

    Phil,

    Thanks for the confirmation. Let's see if there's anyone willing to try this in Word XP. I may be able to get someone for Word 95.

    I did take a quick look at both the Lounge (going back to last Sept) and the MSKB. Found nothing in the former. Probably didn't use the best search terms for the latter and got too many matches. I searched for "headers across sections" and matched on any words. General item about headers and footers was in Q211432. Story seemed to suggest that what I was doing should have worked as I expected; nothing suggested otherwise. No other matches seemed appropriate. Maybe you can find something with a different search phrase.

    Fred

  10. #10
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Odd Hdr/ftr Behavior (2000 SR1)

    Hi Fred:
    I've read every Word post since the Lounge has opened & don't recall that issue ever coming up (not that I can guarantee I remember everything) <img src=/S/grin.gif border=0 alt=grin width=15 height=15>. Still, this would have stuck out, I think. At first, I thought that the odd/even headers might be an explanation as an even header (if I recall right) is a "normal" header. But I don't know why you would lose the first page header. If I'm game (or you are), I may try it with 4 pages in each section & maybe a third section, to see if the behavior is the same.

  11. #11
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Odd Hdr/ftr Behavior (2000 SR1)

    XP flaws are identical to your description. <img src=/S/bummer.gif border=0 alt=bummer width=15 height=15>

  12. #12
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Odd Hdr/ftr Behavior (2000 SR1)

    Hi Phil,

    That's a lot of posts to read! <img src=/S/doze.gif border=0 alt=doze width=15 height=15> {or any other of many smilies}

    (edited to identify correct Andrew-thanks)

    AndrewO (not Andrew Lockton) is reporting same problem with XP.

    I gave 3 sections, each with 4 pages a shot. Here's the drill.

    1. new document.
    2. with Arial 11 point (don't know why I changed), =rand(30,10) will get 4 pages.
    3. set up my headers for "diff 1st" and "diff o/e" and put 1f, 1o, 1e into respective headers
    4. at end of sec1, inserted sec break next page
    5. =rand(30,10) gets 4 pages more for sec 2
    6. at end of sec 2, insert sec break next page
    7. =rand(30,10) gets 4 pages for sec 3
    8. go back to sec 2, undo Same As Previous (SAP) for sec 2 and fix headers to read 2f, 2e, 2o
    9. go to sec 3, undo SAP, and fix headers to read 3f, 3o, 3e
    10. in sec 3, uncheck "diff 1st" and uncheck "diff o/e" with the result of
    - sec 2 lost its "diff o/e" with the "header" for pages beyond first of sec 2 having 2o (still has "diff 1st" with 2f)
    - sec 1 lost its "diff o/e" with the "header" for pages beyond first of sec 1 having 1o (still has "diff 1st" with 1f)
    11. in sec 1, check "diff o/e" (diff 1st still checked) with result of
    - sec 2 now has "diff o/e" checked with proper headings (2f, 2e, 2o)
    - sec 3 now has "diff o/e" checked with 3o and 3e but does not have "diff 1st"

    Is there a pattern in this?

    Want to try for 4 sections each of a gazillion pages?

    I think, based on one of my earlier posts, that the "normal" header is an odd (as in not even) header. There were some word constants (wd...) in the VBA but wd...Odd seemed to be missing. There was also something called a wd...Primary header.

    Fred

  13. #13
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Odd Hdr/ftr Behavior (2000 SR1)

    Thanks for clarifying the odd/even header, Fred. From VBA help:

    "If the OddAndEvenPagesHeaderFooter property is True, you can return an odd header or footer by using wdHeaderFooterPrimary, and you can return an even header or footer by using wdHeaderFooterEvenPages."

    So you are correct that the odd header/footer is the "normal" header/footer.

  14. #14
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Odd Hdr/ftr Behavior (2000 SR1)

    Phil,

    A friend of mine indicated that the behavior outlined in my 9-step test (see this post) was also observed in his copies of Word 6 and Word 7 (aka 95) pretty much. That is, he observed the strange behavior of my step #8 in both versions. However, step #9 did behave as expected.

    Since he described something else that was a bit odd, I may try to go over his house this weekend. If anyone else has these versions, check out the test noted in the above post and let us know.

    Fred

Posting Permissions

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