admin管理员组

文章数量:817297

word文档封面不显示页码双面页码vba宏代码

Sub 有封面双页码()

'

' 有封面双页码 宏

'

'

Dim oSection As Section

For Each oSection In Word.ActiveDocument.Sections

With oSection.PageSetup

.DifferentFirstPageHeaderFooter = True '设置页眉页脚的首页不同

.OddAndEvenPagesHeaderFooter = True '设置页眉页脚的奇偶页不同

End With

Next

Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="1"

ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter

Selection.WholeStory

Selection.Delete

Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="2"

ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter

Selection.WholeStory

Selection.Delete

Selection.TypeText Text:="— "

Application.Templates( _

"C:\Users\Administrator\AppData\Roaming\Microsoft\Document Building Blocks\2052\16\Built-In Building Blocks.dotx" _

).BuildingBlockEntries("普通数字").Insert Where:=Selection.Range, RichText:= _

True'设置页码为普通数字,需要word版本支持普通数字页码格式

Selection.TypeText Text:=" —"

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 = wdSeekCurrentPageFooter

Selection.WholeStory

Selection.Font.Size = 14

403 Forbidden = "宋体"

Selection.ParagraphFormat.Alignment = wdAlignParagraphRight'设置页码靠右

Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="3"

ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter

Selection.WholeStory

Selection.Delete

Selection.TypeText Text:="— "

Application.Templates( _

"C:\Users\Administrator\AppData\Roaming\Microsoft\Document Building Blocks\2052\16\Built-In Building Blocks.dotx" _

).BuildingBlockEntries("普通数字").Insert Where:=Selection.Range, RichText:= _

True'设置页码为普通数字,需要word版本支持普通数字页码格式

Selection.TypeText Text:=" —"

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 = wdSeekCurrentPageFooter

Selection.WholeStory

Selection.Font.Size = 14

403 Forbidden = "宋体"

End Sub

本文标签: word文档封面不显示页码双面页码vba宏代码