Section properties imported to previous section when deleted
-
- SilverLounger
- Posts: 2389
- Joined: 28 Mar 2010, 01:49
Section properties imported to previous section when deleted
When I delete a Next Page Section Break, the properties (page margins, headers, footers, etc.) of the Next Page Section are imported into the Section of the previous pages. I then have to reformat the margins, headers, etc. of the first page of my document. How can I prevent his from happening?
Regards,
JMT
JMT
-
- 5StarLounger
- Posts: 720
- Joined: 21 Aug 2011, 21:01
- Location: The beautiful hills of Western North Carolina
Re: Section properties imported to previous section when del
I've found Section Breaks and Header/Footer behavior to be one of the most unintuitive of Word editing tasks. But this is what I do:
Before deleting the Next Page Section Break, go into the headers and footers of the section you want to remove. If you see a tab that says "Same as Previous", click "Link to Previous" on the Header & Footer Tools Tab > Navigation Group. It should be highlighted if "Same as Previous" appears and the highlighting will disappear when it's off. Once the footer and header no longer say "Same as Previous", you can safely delete the Section Break.
Does this help? Kim
Before deleting the Next Page Section Break, go into the headers and footers of the section you want to remove. If you see a tab that says "Same as Previous", click "Link to Previous" on the Header & Footer Tools Tab > Navigation Group. It should be highlighted if "Same as Previous" appears and the highlighting will disappear when it's off. Once the footer and header no longer say "Same as Previous", you can safely delete the Section Break.
Does this help? Kim
"Hmm. What does this button do?" Said everyone before being ejected from a car, blown up, or deleting all the data from the mainframe.
-
- 5StarLounger
- Posts: 619
- Joined: 10 Jan 2016, 15:56
- Location: Madison, Wisconsin
Re: Section properties imported to previous section when del
A section break carries the formatting for the section that precedes the break, not the one that follows it. From that, you get the problematic behavior.
Here are two MVP macros that may help:
... too long. Will continue in next post.
Here are two MVP macros that may help:
Code: Select all
Sub SectionsMerge1()
' Paul Edstein July 14, 2011
' http://www.msofficeforums.com/word/8187-delete-page-after-section-break-next-page.html#post20227
' Merge sections - select two or more sections
'
Application.ScreenUpdating = False
Dim sPageHght As Single, sPageWdth As Single
Dim sHeaderDist As Single, sFooterDist As Single
Dim sTMargin As Single, sBMargin As Single
Dim sLMargin As Single, sRMargin As Single
Dim sGutter As Single, sGutterPos As Single
Dim lPaperSize As Long, lGutterStyle As Long
Dim lMirrorMargins As Long, lVerticalAlignment As Long
Dim lScnStart As Long, lScnDir As Long
Dim lOddEvenHdFt As Long, lDiffFirstHdFt As Long
Dim bTwoPagesOnOne As Boolean, bBkFldPrnt As Boolean
Dim bBkFldPrnShts As Boolean, bBkFldRevPrnt As Boolean
Dim bOrientation As Boolean, oHdFt As HeaderFooter
Dim Sctn1 As Section, Sctn2 As Section
With Selection
If .Sections.Count = 1 Then
MsgBox "Selection does not span a Section break", vbExclamation
Exit Sub
End If
Set Sctn1 = .Sections.First: Set Sctn2 = .Sections.Last
With Sctn1.PageSetup
lPaperSize = .PaperSize
lGutterStyle = .GutterStyle
bOrientation = .Orientation
lMirrorMargins = .MirrorMargins
lScnStart = .SectionStart
lScnDir = .SectionDirection
lOddEvenHdFt = .OddAndEvenPagesHeaderFooter
lDiffFirstHdFt = .DifferentFirstPageHeaderFooter
lVerticalAlignment = .VerticalAlignment
sPageHght = .PageHeight
sPageWdth = .PageWidth
sTMargin = .TopMargin
sBMargin = .BottomMargin
sLMargin = .LeftMargin
sRMargin = .RightMargin
sGutter = .Gutter
sGutterPos = .GutterPos
sHeaderDist = .HeaderDistance
sFooterDist = .FooterDistance
bTwoPagesOnOne = .TwoPagesOnOne
bBkFldPrnt = .BookFoldPrinting
bBkFldPrnShts = .BookFoldPrintingSheets
bBkFldRevPrnt = .BookFoldRevPrinting
End With
With Sctn2.PageSetup
.GutterStyle = lGutterStyle
.MirrorMargins = lMirrorMargins
.SectionStart = lScnStart
.SectionDirection = lScnDir
.OddAndEvenPagesHeaderFooter = lOddEvenHdFt
.DifferentFirstPageHeaderFooter = lDiffFirstHdFt
.VerticalAlignment = lVerticalAlignment
.PageHeight = sPageHght
.PageWidth = sPageWdth
.TopMargin = sTMargin
.BottomMargin = sBMargin
.LeftMargin = sLMargin
.RightMargin = sRMargin
.Gutter = sGutter
.GutterPos = sGutterPos
.HeaderDistance = sHeaderDist
.FooterDistance = sFooterDist
.TwoPagesOnOne = bTwoPagesOnOne
.BookFoldPrinting = bBkFldPrnt
.BookFoldPrintingSheets = bBkFldPrnShts
.BookFoldRevPrinting = bBkFldRevPrnt
.PaperSize = lPaperSize
.Orientation = bOrientation
End With
With Sctn2
For Each oHdFt In .Footers
oHdFt.LinkToPrevious = Sctn1.Footers(oHdFt.Index).LinkToPrevious
If oHdFt.LinkToPrevious = False Then
With oHdFt.range
.FormattedText = Sctn1.Footers(oHdFt.Index).range.FormattedText
Do While .Characters.Last.Previous = vbCr
.Characters.Last.Previous.Delete
If .Characters.Count = 1 Then Exit Do
Loop
End With
End If
Next
For Each oHdFt In .Headers
oHdFt.LinkToPrevious = Sctn1.Headers(oHdFt.Index).LinkToPrevious
If oHdFt.LinkToPrevious = False Then
With oHdFt.range
.FormattedText = Sctn1.Headers(oHdFt.Index).range.FormattedText
Do While .Characters.Last.Previous = vbCr
.Characters.Last.Previous.Delete
If .Characters.Count = 1 Then Exit Do
Loop
End With
End If
Next
End With
While .Sections.Count > 1
.Sections.First.range.Characters.Last.Delete
Wend
End With
Set Sctn1 = Nothing: Set Sctn2 = Nothing
Application.ScreenUpdating = True
End Sub
Attorney Charles Kenyon
Templates in Microsoft Word
Modifying the QAT
The Importance of Styles in Microsoft Word
Templates in Microsoft Word
Modifying the QAT
The Importance of Styles in Microsoft Word
-
- 5StarLounger
- Posts: 619
- Joined: 10 Jan 2016, 15:56
- Location: Madison, Wisconsin
Re: Section properties imported to previous section when del
--- continued
and
It has been a while since I grabbed these from a forum. Try them on a copy of your problem document.
Try to not add unnecessary section breaks!
and
Code: Select all
Sub SectionsMerge2() ' Paul Edstein
' Paul Edstein
' [url]https://social.technet.microsoft.com/Forums/en-US/a2edf195-e9ad-4163-a246-3c1c94ecb0e7/how-to-delete-a-section-break-without-loosing-the-format-of-the-previous-section?forum=word#8fddc857-b28f-4ddb-a4fb-be6003223be1[/url]
' Merge sections while preserving formatting of next-to-last section and deleting last section
'
' SELECT SECTIONS to be merged before running macro
'
' November 14, 2013
'
Application.ScreenUpdating = False
Dim sPageHght As Single, sPageWdth As Single
Dim sHeaderDist As Single, sFooterDist As Single
Dim sTMargin As Single, sBMargin As Single
Dim sLMargin As Single, sRMargin As Single
Dim sGutter As Single, sGutterPos As Single
Dim lPaperSize As Long, lGutterStyle As Long
Dim lMirrorMargins As Long, lVerticalAlignment As Long
Dim lScnStart As Long, lScnDir As Long
Dim lOddEvenHdFt As Long, lDiffFirstHdFt As Long
Dim bTwoPagesOnOne As Boolean, bBkFldPrnt As Boolean
Dim bBkFldPrnShts As Boolean, bBkFldRevPrnt As Boolean
Dim bOrientation As Boolean, oHdFt As HeaderFooter
Dim Sctn1 As Section, Sctn2 As Section
'
With Selection
If .Sections.Count = 1 Then
MsgBox "Selection does not span a Section break", vbExclamation
Exit Sub
End If
'
Set Sctn1 = .Sections.First: Set Sctn2 = .Sections.Last
'
With Sctn1.PageSetup
lPaperSize = .PaperSize
lGutterStyle = .GutterStyle
bOrientation = .Orientation
lMirrorMargins = .MirrorMargins
lScnStart = .SectionStart
lScnDir = .SectionDirection
lOddEvenHdFt = .OddAndEvenPagesHeaderFooter
lDiffFirstHdFt = .DifferentFirstPageHeaderFooter
lVerticalAlignment = .VerticalAlignment
sPageHght = .PageHeight
sPageWdth = .PageWidth
sTMargin = .TopMargin
sBMargin = .BottomMargin
sLMargin = .LeftMargin
sRMargin = .RightMargin
sGutter = .Gutter
sGutterPos = .GutterPos
sHeaderDist = .HeaderDistance
sFooterDist = .FooterDistance
bTwoPagesOnOne = .TwoPagesOnOne
bBkFldPrnt = .BookFoldPrinting
bBkFldPrnShts = .BookFoldPrintingSheets
bBkFldRevPrnt = .BookFoldRevPrinting
End With
'
With Sctn2.PageSetup
.GutterStyle = lGutterStyle
.MirrorMargins = lMirrorMargins
.SectionStart = lScnStart
.SectionDirection = lScnDir
.OddAndEvenPagesHeaderFooter = lOddEvenHdFt
.DifferentFirstPageHeaderFooter = lDiffFirstHdFt
.VerticalAlignment = lVerticalAlignment
.PageHeight = sPageHght
.PageWidth = sPageWdth
.TopMargin = sTMargin
.BottomMargin = sBMargin
.LeftMargin = sLMargin
.RightMargin = sRMargin
.Gutter = sGutter
.GutterPos = sGutterPos
.HeaderDistance = sHeaderDist
.FooterDistance = sFooterDist
.TwoPagesOnOne = bTwoPagesOnOne
.BookFoldPrinting = bBkFldPrnt
.BookFoldPrintingSheets = bBkFldPrnShts
.BookFoldRevPrinting = bBkFldRevPrnt
.PaperSize = lPaperSize
.Orientation = bOrientation
End With
'
With Sctn2
For Each oHdFt In .Footers
oHdFt.LinkToPrevious = Sctn1.Footers(oHdFt.Index).LinkToPrevious
If oHdFt.LinkToPrevious = False Then
Sctn1.Headers(oHdFt.Index).range.Copy
oHdFt.range.Paste
End If
Next
For Each oHdFt In .Headers
oHdFt.LinkToPrevious = Sctn1.Headers(oHdFt.Index).LinkToPrevious
If oHdFt.LinkToPrevious = False Then
Sctn1.Headers(oHdFt.Index).range.Copy
oHdFt.range.Paste
End If
Next
End With
While .Sections.Count > 1
.Sections.First.range.Characters.Last.Delete
Wend
Set Sctn1 = Nothing: Set Sctn2 = Nothing
End With
Application.ScreenUpdating = True
End Sub
Try to not add unnecessary section breaks!
Attorney Charles Kenyon
Templates in Microsoft Word
Modifying the QAT
The Importance of Styles in Microsoft Word
Templates in Microsoft Word
Modifying the QAT
The Importance of Styles in Microsoft Word
-
- SilverLounger
- Posts: 2389
- Joined: 28 Mar 2010, 01:49
Re: Section properties imported to previous section when del
I suspect this will work only with headers and footers. Do I still have to then manually format the margins and other formatting of the section preceding the section break after I delete the section break?kdock wrote:I've found Section Breaks and Header/Footer behavior to be one of the most unintuitive of Word editing tasks. But this is what I do:
Before deleting the Next Page Section Break, go into the headers and footers of the section you want to remove. If you see a tab that says "Same as Previous", click "Link to Previous" on the Header & Footer Tools Tab > Navigation Group. It should be highlighted if "Same as Previous" appears and the highlighting will disappear when it's off. Once the footer and header no longer say "Same as Previous", you can safely delete the Section Break.
Does this help? Kim
Regards,
JMT
JMT
-
- 5StarLounger
- Posts: 720
- Joined: 21 Aug 2011, 21:01
- Location: The beautiful hills of Western North Carolina
Re: Section properties imported to previous section when del
Good question.
You expressed concern that your first section will inherit the page margins of the second section and the answer is no, the margins will be unchanged when you use the steps I mentioned.
But you referred to other possible formatting. What other things have you had to reformat?
Perhaps the macros Charles provided will address all of your concerns.
Best, Kim
You expressed concern that your first section will inherit the page margins of the second section and the answer is no, the margins will be unchanged when you use the steps I mentioned.
But you referred to other possible formatting. What other things have you had to reformat?
Perhaps the macros Charles provided will address all of your concerns.
Best, Kim
"Hmm. What does this button do?" Said everyone before being ejected from a car, blown up, or deleting all the data from the mainframe.
-
- 4StarLounger
- Posts: 508
- Joined: 17 Dec 2010, 03:14
Re: Section properties imported to previous section when del
See: http://www.eileenslounge.com/viewtopic.php?t=27951" onclick="window.open(this.href);return false;
Paul Edstein
[Fmr MS MVP - Word]
[Fmr MS MVP - Word]