1、WORD视图中 添加宏,代码如下
Sub 插入普通页码() ActiveDocument.PageSetup.OddAndEvenPagesHeaderFooter = False '关闭奇偶页相同(防止上回启用奇偶页不同后没有关闭此项设置) With ActiveWindow.ActivePane.View .SeekView = wdSeekCurrentPageFooter With Selection .Expand wdStory .Font.Size = 10.5 '字号 .Font.Name = "宋体" '字体 .ParagraphFormat.Alignment = wdAlignParagraphCenter .TypeText "第" .Fields.Add .Range, wdFieldPage .TypeText "页/共" .Fields.Add .Range, wdFieldNumPages .TypeText "页" .ParagraphFormat.Alignment = wdAlignParagraphCenter '页码的位置居中 End With
2、在WORD选项---->自定义---->自定义快捷键---->宏(选择相应宏),设置快捷键(如:ALT+P),即可快速添加页码