|
- Sub Wordvba遍历文件夹()
- Dim MyDialog As FileDialog, vrtSelectedItem As Variant, Doc As Document
- Dim Rngtxt As Range
- Application.ScreenUpdating = False
- On Error Resume Next
- Set MyDialog = Application.FileDialog(msoFileDialogFilePicker)
- With MyDialog
- .Filters.Clear
- .Filters.Add "所有 WORD 文件", "*.doc", 1
- .AllowMultiSelect = True
- If .Show = -1 Then
- Application.ScreenUpdating = False
- For Each vrtSelectedItem In .SelectedItems
- Set Doc = Documents.Open(FileName:=vrtSelectedItem, Visible:=False)
- Set Rngtxt = Doc.Content
- With Rngtxt.Find
- .Text = "(包括:^13)[!^13]@(^13[!^13]@包括:)"
- .Replacement.Text = "\1\2"
- .Text = "(。^13)[!一-﨩]@(^13签名:)"
- .Replacement.Text = "\1\2"
- .MatchWildcards = True
- .Execute Replace:=wdReplaceAll
- End With
- Doc.Close True
- Next
- Application.ScreenUpdating = True
- End If
- End With
- MsgBox "操作完毕!", vbInformation
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|