各位兄台的方法真是五花八门,小弟看得不太明白,不过不一定非得用页眉页脚吧?用文本框也行啊,反正设置了边框为无色,谁也看不出是页脚还是文本框了.顺便说一下,文本框可是个好东东啊,很多解决不了的问题用它就可以搞定啊!
Sub 设置页码()
'包括每一节的页码及总页码
pagescount = ActiveDocument.BuiltInDocumentProperties(wdPropertyPages)
'文档的总页数
sectionno = 0 '每节中的页码
sectionnumber = 0 '节号
For i = 1 To pagescount
Selection.GoTo wdGoToPage, wdGoToAbsolute, i
If sectionnumber <> Selection.Information(wdActiveEndSectionNumber) Then
sectionnumber = Selection.Information(wdActiveEndSectionNumber)
sectionno = 1
Else
sectionno = sectionno + 1
End If
ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 233.85, _
805.2, 162#, 23.4).Select
Selection.TypeText Text:="第" & sectionnumber & "节" & "第" & sectionno & "页" & _
" " & "总第" & i & "页"
Selection.ShapeRange.Line.ForeColor.RGB = RGB(255, 255, 255)
Next i
End Sub
[此贴子已经被惊叹不已于2002-12-2 11:17:45编辑过] |