J
Jack Sons
Hi all,
With the code below I wanted to get rid of the page header of page 2, the
last page of the doc, after which I remove the entire page 2. Unfortunately
also the pageheader of page 1 disappears.
If possible I would like to use code that deletes page 2 anyhow, with its
header if it has one, but leaving page 1 as it was, including its header if
it has one. If somebody would show me the code I would be most grateful.
If it is necessary to remove the header before deleting the page (like I did
in my code) that is OK with me, but please show me how my code should be
changed to obtain the desired result (that is leaving page 1 intact).
Perhaps the code could be much simpler than mine.
Jack Sons
The Netherlands
----------------------------------------------------------------------------
------------------------
Sub Macro7()
Selection.EndKey Unit:=wdStory
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
ActiveWindow.ActivePane.LargeScroll Down:=-2
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Selection.MoveUp Unit:=wdParagraph, Count:=1, Extend:=wdExtend
Selection.EndKey Unit:=wdLine
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
End Sub
With the code below I wanted to get rid of the page header of page 2, the
last page of the doc, after which I remove the entire page 2. Unfortunately
also the pageheader of page 1 disappears.
If possible I would like to use code that deletes page 2 anyhow, with its
header if it has one, but leaving page 1 as it was, including its header if
it has one. If somebody would show me the code I would be most grateful.
If it is necessary to remove the header before deleting the page (like I did
in my code) that is OK with me, but please show me how my code should be
changed to obtain the desired result (that is leaving page 1 intact).
Perhaps the code could be much simpler than mine.
Jack Sons
The Netherlands
----------------------------------------------------------------------------
------------------------
Sub Macro7()
Selection.EndKey Unit:=wdStory
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
ActiveWindow.ActivePane.LargeScroll Down:=-2
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Selection.MoveUp Unit:=wdParagraph, Count:=1, Extend:=wdExtend
Selection.EndKey Unit:=wdLine
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
End Sub