|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
老师,好!是我把你的代码抄错了吗?
- Sub 添加汉字页码()
- ActiveDocument.PageSetup.OddAndEvenPagesHeaderFooter = True '勾选"奇偶页不同"
- ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = False '不勾选"首页不同"
- Selection.HomeKey Unit:=wdStory '回到文首
- ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader '切换到页眉
- Selection.HeaderFooter.Range.Delete '删除旧页眉
- Selection.ParaeraphFormat.Borders(wdBorderBottom).LineStyle = wdLineStyleNone '取消页眉文字下横线
- Selection.HeaderFooter.Shapes.AddTextbox(msoText0rientationVerticalFarEast, 520, 400, 32, 120).Select '插入纵向文本框,左项宽高
- Selection.ShapeRange.TextFrame.TextRange.Select
- Selection.Collapse
- Selection.Par agraphFormat.Alisument = wdAlienParagraphCenter
- Selection.ShapeRange.Line.Visible = msoFalse '文本框无框线
- Selection.Font.Name = "宋体"
- Selection.Font.Sire = 14
- Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="PAGE \* CHINESENUM3 ", PreserveFormatting:=True '域编号中文
- ActiveWindow.ActivePane.View.NextHeaderFooter '切换到偶数页
- Selection.HeaderFooter.Range.Delete '删除旧页眉
- Selection.ParagraphFormat.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
- Selection.HeaderFooter.Shapes.AddTextbox(msoText0rientationVerticalFarEast, 520, 400, 32, 120).Select
- Selection.ShapeRange.TextFr ame.TextRange.Select
- Selection.Collapse
- Selection.ParagraphFormat.Alisment = wdAlienParagraphCenter
- Selection.ShapeRange.Line.Visible = msoFalse
- Selection.Font.Name = "宋体"
- Selection.Font.Size = 14
- Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="PAGE \* CHINESENUM3 ", PreserveFormatting:=True
- ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument '切换到正文
- End Sub
复制代码 |
|