|
发表于 2015-5-28 07:51
来自手机
|
显示全部楼层
本帖最后由 kqbt 于 2015-5-28 10:56 编辑
- Sub BatchChangeColor()
- Dim wNum As Long, wDoc As Document
- With Application.FileDialog(msoFileDialogFilePicker)
- .AllowMultiSelect = True
- .Filters.Clear
- .Filters.Add "Word 文档", "*.doc;*.doc*"
- If .Show <> -1 Then Exit Sub
- Application.ScreenUpdating = False
- For wNum = 1 To .SelectedItems.Count
- Set wDoc = Documents.Open(.SelectedItems(wNum), Visible:=False)
- With wDoc.Range.Find
- With ActiveDocument.Range.Find
- .ClearFormatting
- .Replacement.ClearFormatting
- .Replacement.Font.Color = wdColorBlue
- .Execute "^13\<目录\>*^13\<篇名\>*^13", , , True, , , , , , , wdReplaceAll
- End With
- End With
- wDoc.Close True
- Next
- Application.ScreenUpdating = True
- MsgBox "共完成 " & wNum - 1 & " 个文档!"
- End With
- End Sub
复制代码
|
|