word文档批量编辑一个文件夹里有几十
Word本身的宏功能就可以实现,参考如下代码:
Sub Hi_FontLines()
Dim iPath As String, i As Integer, iDoc As Document
Application。 ScreenUpdating = False
With Application。FileDialog(msoFileDialogFolderPicker)
。Title = "请选择目标文件夹"
If 。 Show = -1 Then
iPath = 。SelectedItems(1)
Else
Exit Sub
End If
End With
With Applicati...全部
Word本身的宏功能就可以实现,参考如下代码:
Sub Hi_FontLines()
Dim iPath As String, i As Integer, iDoc As Document
Application。
ScreenUpdating = False
With Application。FileDialog(msoFileDialogFolderPicker)
。Title = "请选择目标文件夹"
If 。
Show = -1 Then
iPath = 。SelectedItems(1)
Else
Exit Sub
End If
End With
With Application。
FileSearch
。LookIn = iPath
。FileType = msoFileTypeWordDocuments
If 。Execute > 0 Then
For i = 1 To 。
FoundFiles。Count
Set iDoc = Documents。Open(FileName:=。FoundFiles(i), Visible:=True)
With iDoc。
Range
。Font。Size = 14 '字号:14磅(根据自己需要修改即可)
。ParagraphFormat。LineSpacingRule = wdLineSpace1pt5 '行距:单位行距(根据自己需要修改即可)
End With
iDoc。
Close True
Next
End If
End With
Application。ScreenUpdating = True
End Sub。收起