RE: section break/insert file



"bryan" wrote:

I found the problem. It was in the document itself. I turned on all
formatting marks and seen that it had grayed out footer tabs on the bottom. I
deleted those and all is well. Not sure why it would work fine on the 2 pager
and not the one pager but, that took care of it.

Don't know what you mean by "grayed out footer tabs" but I am glad you
found a solution.

What do you mean by ' making sure that
the header/footer in the section to delete have been unlinked from the
previous section prior to deleting it' ?

Try this:
A)
Create a one page document.
Add a header.
Go to the end of the doucment and insert a "Next Page" section break.
Add some text in that second section.
Select the second section, including the section break itself at the bottom
of the first page (Use the ¶ button to see it).
Hit "Delete".
The header is gone for the whole document.

B)
Now repeat, but before deleting the second section, double-click on the
header at the top of the second page to access the second section header. On
the Header/Footer toolbar, unlink this header from the one on the previous
page.
Now delete the second section with its section break. See the difference?

Here is what I bvelieve happens:
In A), you delete both the section break and the last ¶. Both of these are
the actual container for the section header information (and footer...). But
the last ¶ does not have actual information, it just knows that it should get
its header from the previous section. When the previous section is gone the
new ¶ cannot get information from nothing. So, if you delete both, Word
cannot invent a header for you.. the header is gone. If you preserve the last
¶, Word seems to be able to transfer the info from the first section to this
¶ before deleting the section break.
In B), the section break and the last ¶ both have actual information
regarding the header, even if it is the same infromation. So, when you delete
both the section break and the last ¶, Word can transfer the information from
the last ¶ to the new last ¶ before deleting the old last ¶...

I see that you achieved the same by not selecting the last ¶ of the document
in your code:
Set rnge = ActiveDocument.Sections.Last.Range
rnge.Start = rnge.Start - 1
rnge.Delete

But sometimes, this can have undesirable effects...

Let's say you have a different header in the last section. If you delete
that last section, the header for that section will become the header for the
first section, whether you delete the last ¶ or not. Also, if you do not
delete the last ¶, the first section will inherit the page set up format of
what used to be the last section because the last ¶ was preserved.

If, in such a case, if you want to preserve the the first section header and
page set up, you have to link the second section header to the first section.
This will effectively copy the first sectin header into the second section
header. Then, unlink the second section, otherwise when you delete the second
section, the first section header will be gone (And you cannot use the "do
not include the las ¶" trick or you might change the margins in the first
section). Now you can delete the last section, its section break and the last
¶.

.


Loading