【发布时间】:2017-11-09 14:56:40
【问题描述】:
我希望运行一个 Word 宏,它插入一个带有文件名、日期和页码的页脚。
以下宏在文档正文中插入文件名、日期和页码。如何重写它以将其插入页脚?非常感谢您的帮助:)
'添加页脚宏
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"FILENAME \p ", PreserveFormatting:=True
Selection.HomeKey Unit:=wdLine
Selection.TypeParagraph
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.TypeText Text:=vbTab
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"PAGE \* Arabic ", PreserveFormatting:=True
Selection.TypeText Text:=vbTab
Selection.InsertDateTime DateTimeFormat:="M/d/yyyy H:mm", InsertAsField:= _
True, DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern, _
InsertAsFullWidth:=False
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Font.Size = 8
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
Selection.Font.Size = 8
结束子`
【问题讨论】:
标签: vba ms-word formatting