|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 第一页首行内容()
Dim rngS As Range, rngE As Range, 第一页首行内容 As String
Set rngS = ActiveDocument.Paragraphs(1).Range
Set rngE = ActiveDocument.Paragraphs(1).Range.GoTo(what:=wdGoToLine, which:=wdGoToNext, Count:=1)
第一页首行内容 = ActiveDocument.Range(rngS.Start, rngE.Start)
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter '切换到页脚
第一页首行内容 = Replace(第一页首行内容, Chr(10), "")
第一页首行内容 = Replace(第一页首行内容, Chr(13), "")
With Selection
.WholeStory
.Delete
.TypeText 第一页首行内容 & " "
Application.Run "InsertFieldchars"
.Text = " page "
End With
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
ActiveWindow.View.ShowFieldCodes = False
End Sub
|
|