如何使用 VBA 删除单词页脚中的时间戳?
我不知道时间戳说的是什么。只是有 DD/MM/YYYY 时间戳。
页脚中除了时间戳之外还有其他内容,我不想被删除。
我尝试过编辑页脚中的文本范围,但它只会破坏文档。根据我的经验,我认为你不能在页脚上执行此操作:
Dim footr As Word.HeaderFooter
For Each footr In ActiveDocument.Sections(1).Footers
'With footr.Range
If footr.Range.Text <> "" Then
footr.Range.Delete unit:=wdCharacter, Count:=-20
End If
'End With
Next footr
Option Explicit
Sub RemoveFooter()
Dim oSec As Section
For Each oSec In ActiveDocument.Sections
oSec.Footers(wdHeaderFooterPrimary).Range.Text = ""
Next
End Sub