|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub ChangRiqi()
Dim doc As Document, fol As Object, aFile$, Aset$
Set fol = CreateObject("Shell.Application").BrowseForFolder(0, "目标文件夹", 0)
If Not fol Is Nothing Then pa$ = fol.Items.Item.Path Else MsgBox "请选目标文件夹": Exit Sub
If Right(pa, 1) <> "\" Then pa = pa & "\"
aFile = Dir(pa & "*.doc*")
Aset = InputBox("输入更改的日期", , "2017-2-10")
If Aset = "" Then MsgBox "你没有输入日期!请输入日期": Exit Sub
Do While aFile <> ""
If ThisDocument.Name <> aFile Then
Set doc = Documents.Open(pa & aFile, Visible:=False)
If doc.Bookmarks.Exists("djsj") Then
With doc.Bookmarks("djsj").Range
.MoveEndUntil vbCr
.Text = Aset
End With
doc.ActiveWindow.View.Type = 4
doc.Close -1
Else
doc.Close 0
End If
End If
aFile = Dir
Loop
MsgBox "OK!"
End Sub |
|