Article ID: 162938
Article Last Modified on 1/19/2007
Sub ViewHeaderFooterExample()
' Add this line that dimensions a variable.
' to store the current view.
Dim OriginalView As Long ' <-- Add
' Recorded Code.
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
' Add this line that captures the current view.
OriginalView = ActiveWindow.ActivePane.View.Type ' <-- Add
' Recorded Code.
If ActiveWindow.ActivePane.View.Type = wdNormalView Or _
ActiveWindow.ActivePane.View.Type = wdOutlineView Or _
ActiveWindow.ActivePane.View.Type = wdMasterView Then
ActiveWindow.ActivePane.View.Type = wdPageView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
' Add this line that returns the view to the original view.
ActiveWindow.ActivePane.View.Type = OriginalView ' <-- Add
End Sub
173707 OFF97: How to Run Sample Code from Knowledge Base Articles
176476 OFF: Office Assistant Not Answering Visual Basic Questions
163435 VBA: Programming Resources for Visual Basic for Applications
Additional query words: wordcon vb vba vbe record Master Outline Online
Keywords: kbbug kbdtacode kbmacroexample kbnofix KB162938