|
楼主的问题应该改为:《如何用VBA设置公文一字线页码》。
sylun 和 sqhsqhli 两位朋友的代码都很不错,可惜没有做到位。
下面我提供 Word 2003 上所用的《公文一字线页码》宏代码,楼上朋友可以试试可否用在 2007 上。
- Sub 插入页码_公文一字线()
- Dim s As Section
- For Each s In ActiveDocument.Sections
- s.Footers(1).Range.Delete
- With s.Footers(1).Range.Sections(1).Headers(1).PageNumbers
- .NumberStyle = wdPageNumberStyleArabic
- .HeadingLevelForChapter = 0
- .IncludeChapterNumber = False
- .ChapterPageSeparator = wdSeparatorHyphen
- .RestartNumberingAtSection = False
- .StartingNumber = 0
- End With
- s.Footers(1).PageNumbers.Add 2, True
- With s.Footers(1).Range.Frames(1).Range
- .Select
- With Selection
- .TypeText Text:=Chr(-24159)
- .InsertSymbol Font:="宋体", CharacterNumber:=8212, Unicode:=True
- .TypeText Text:=" "
- .EndKey 5
- .TypeText Text:=" "
- .InsertSymbol Font:="宋体", CharacterNumber:=8212, Unicode:=True
- .TypeText Text:=Chr(-24159)
- .Expand 4
- With .Font
- .Name = "宋体"
- .Size = 14
- End With
- .ParagraphFormat.CharacterUnitRightIndent = 1.5
- End With
- End With
- Next
- ActiveWindow.ActivePane.Close
- ActiveWindow.View.Type = wdPrintView
- End Sub
复制代码 |
|