Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing a Header pane 1

Status
Not open for further replies.

Jtorres13

Technical User
Nov 11, 2006
162
US
Word 2002, Opening the primary header to delete a bookmark.

ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Bookmarks("Header1").Select


I was able to find the header and open it and delete what I weant. But, how do I close the header? there's this pane that opens at the bottom of the screen, showing the header. i can't close it. it's not the usual dotted line header division on the screen, it looks like a new window pane.

Tried this to close it and change the View but it's not working:

ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
ActiveDocument.ActiveWindow.View = wdPrintView
 
it looks like a new window pane
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
This does close the header pane! But... when it closes, it doesn't apply the changes I made to the header...

When I get in I can change the header but when I get out with your code, the changes are gone and I'm left in Normal View. I want to keep changes and go back to Print Layout.
 
Do NOT open the header pane in the first place. There is absolutely no need to ever open a headerfooter pane IMO. There is no need to Select.
Code:
 ActiveDocument.Sections(1).Headers(1) _
      .Range.Bookmarks("Header1").Delete
deletes only the bookmark itself. Any text in the bookmark will remain.

Code:
 ActiveDocument.Sections(1).Headers(1) _
      .Range.Bookmarks("Header1").[b]Range[/b].Delete
deletes the bookmark AND any content.

This actions the header without ever going into any View pane, or selecting anything.

NOTE: I changed wdHeaderFooterPrimary to 1 simply for simplicity sake.

"A little piece of heaven
without that awkward dying part."

advertisment for Reese's Peanut Butter Cups (a chocolate/peanut butter confection)

Gerry
 
Thank you Fumei. Got it as you suggested. I'll remember that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top