|
本帖最后由 13907933959 于 2018-4-24 11:41 编辑
网友好!
没有前辈出手!那我提供一个由“zhanglei1371”前辈写的代码修改而来的给你,看它行不行?
Sub 查找不统一的日期_替换为统一的日期格式()
Dim ws As Object, arr, fod
With Application.FileDialog(msoFileDialogFolderPicker)
If .Show <> -1 Then Exit Sub Else fod = .InitialFileName
End With
CreateObject("wscript.shell").Run "cmd /c dir " & Chr(34) & fod & "*.doc*" & Chr(34) & " /s /b /a:-d > C:\temdoc.txt", 0, True
Open "C:\temDoc.txt" For Input As #1
arr = Split(StrConv(InputB(LOF(1), 1), vbUnicode), vbCrLf)
Close #1
VBA.Kill "c:\temdoc.txt"
For Each f In arr
If f <> "" Then
Set oDoc = Documents.Open(f, Visible:=True)
With ActiveDocument.Content.Find
.Execute "提交时间:*年*月*日", , , 1, , , , , , "提交时间:2017年 月 日", 2
End With
oDoc.Close True
Set oDoc = Nothing
End If
Next
End Sub
|
|