用vb如何替换word中的页脚
发布网友
发布时间:2024-01-17 01:39
我来回答
共1个回答
热心网友
时间:2024-02-18 11:46
可以先在word中录制一段VB代码的宏,主要修改页脚,作参考调用:
Sub Macro1()
'
' Macro1 Macro
' 宏在 2008-5-23 由 微软用户 录制
'
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
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
End If
Selection.TypeText Text:="2008 "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldNumPages
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
以上宏中,我主要在页脚插入2008,以及页码