|
- Sub 重排页码()
- Dim i&, j&, k&
- If MsgBox("是否重排页码(否则顺延)?", 4 + 48) = vbYes Then k = 1
- With ActiveDocument
- j = .Sections.Count
- '第1节:封面,无页码!
- With .Sections(1)
- .Footers(wdHeaderFooterPrimary).Range.Delete
- .Headers(wdHeaderFooterPrimary).Range.ParagraphFormat.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
- End With
- '第2节:目录,有页码!格式:罗马数字
- With .Sections(2).Footers(wdHeaderFooterPrimary)
- .LinkToPrevious = False
- .Range.Delete
- With .PageNumbers
- .NumberStyle = wdPageNumberStyleUppercaseRoman
- .RestartNumberingAtSection = True
- .StartingNumber = 1
- .Add PageNumberAlignment:=wdAlignPageNumberCenter, FirstPage:=True
- End With
- '*********************************
- With .Range.Font
- .NameAscii = "Times New Roman"
- .Size = 42
- .Bold = True
- .ColorIndex = wdRed
- End With
- End With
- '第3节:正文,有页码!格式:-1-/k=1:重排/k=0:顺延
- For i = 3 To j
- With .Sections(i).Footers(wdHeaderFooterPrimary)
- If k = 1 Then
- .LinkToPrevious = False
- Else
- .LinkToPrevious = True
- End If
- .Range.Delete
- With .PageNumbers
- .NumberStyle = wdPageNumberStyleNumberInDash
- If k = 1 Then
- .RestartNumberingAtSection = True
- Else
- .RestartNumberingAtSection = False
- End If
- .StartingNumber = 1
- .Add PageNumberAlignment:=wdAlignPageNumberCenter, FirstPage:=True
- End With
- '*********************************
- With .Range.Font
- .NameAscii = "Times New Roman"
- .Size = 42
- .Bold = True
- .ColorIndex = wdBlue
- End With
- End With
- Next
- If k = 0 Then
- With .Sections(3).Footers(wdHeaderFooterPrimary)
- .LinkToPrevious = False
- With .PageNumbers
- .RestartNumberingAtSection = True
- .StartingNumber = 1
- End With
- End With
- End If
- End With
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|