作者:乔山办公网日期:
返回目录:word文档
也就是你想改后面的页眉但是不想影响前面的对吧 那么在你要改的页眉 上一页加个分节符 就不会相互影响了
修改如下:百
Sub 删除页眉度页问脚()
Dim myRange As Range
On Error Resume Next
For Each oSec In ThisDocument.Sections '文档的节中答循环
Set myRange = oSec.Headers(wdHeaderFooterPrimary).Range
myRange.Delete '删除页眉中的专内容
myRange.ParagraphFormat.Borders(wdBorderBottom).LineStyle = wdLineStyleNone '段落下边框属线
Set myRange = oSec.Footers(wdHeaderFooterPrimary).Range
myRange.Delete '删除页脚中的内容
Next
End Sub
Sub setPageFont() Application.PrintCommunication = False With ActiveSheet.PageSetup .LeftHeader = "" '页百眉左设置为:度空知 .CenterHeader = "&F" '页眉中设置为:文件名道 .RightHeader = "" '页眉右设置为:空 .LeftFooter = "&B 机密 &B" '页脚左专设置为:加粗的 机密两个字属 .CenterFooter = "&D" '页脚中设置为:当前日期 .RightFooter = " 第 &P 页" '页脚右设置为:页码 End With Application.PrintCommunication = TrueEnd Sub
其实通过宏录制你就完全可以明白,有些问题是可以自己轻易解决的,宏录制是学e68a84e799bee5baa6e79fa5e98193363习vba很重要的一个步骤,自己要多尝试 :
如下
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
ActiveDocument.AttachedTemplate.BuildingBlockEntries(" 空白").Insert Where:= _
Selection.Range, RichText:=True
Selection.TypeText Text:="暗暗暗暗"