乔山办公网我们一直在努力
您的位置:乔山办公网 > word文档 > <em>WORD</em> <em>VBA</em>:根据以下代码,改成

<em>WORD</em> <em>VBA</em>:根据以下代码,改成

作者:乔山办公网日期:

返回目录: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:="暗暗暗暗"

相关阅读

  • <em>WORD</em> <em>VBA</em>:根据以下代码,改成

  • 乔山办公网word文档
  • 也就是你想改后面的页眉但是不想影响前面的对吧 那么在你要改的页眉 上一页加个分节符 就不会相互影响了Word2010 vba 页眉替换问题" src="/uploads/tu/516.jpg" style="width: 400px; height: 267px;" /
关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网