|
不要老审核,每次回复都审核。
Sub 批量插入不同的页眉页脚()
Dim oDoc As Document
Set oDoc = Word.ActiveDocument
Dim oSec As Section, t As String
With oDoc
On Error Resume Next
For i = 1 To .Sections.Count
With .Sections(i)
sr = Replace(Left(.Range.Text, Len(.Range.Text) - 2), Chr(12), "")
If InStr(sr, "[") > 0 Then
k = 1: t = sr
.Headers(wdHeaderFooterPrimary).LinkToPrevious = False
.Headers(wdHeaderFooterPrimary).Range.Text = sr
.Footers(wdHeaderFooterPrimary).LinkToPrevious = False
.Footers(wdHeaderFooterPrimary).Range.Text = sr & "第1页"
Else
k = k + 1
.Footers(wdHeaderFooterPrimary).LinkToPrevious = False
.Footers(wdHeaderFooterPrimary).Range.Text = t & "第" & k & "页"
End If
End With
Next
End With
End Sub
|
评分
-
1
查看全部评分
-
|