导航

替换页眉页脚[word]

Posted on 2011-06-06 21:23  半点忧伤  阅读(1183)  评论(1编辑  收藏  举报

Sub 替换页眉页脚()
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then ActiveWindow.Panes(2).Close
With ActiveWindow.ActivePane.View
  .Type = wdPrintView
  .SeekView = wdSeekCurrentPageHeader
  Selection.WholeStory
  Selection.Delete Unit:=wdCharacter, Count:=1
  Selection.TypeText Text:="这是替换后的页眉"
  .SeekView = wdSeekMainDocument
End With

WordBasic.ViewFooterOnly
Selection.WholeStory
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="这是替换后的页脚"
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub