WORD、高手们、宏、VBA、宏有关批量运行
怎么自动对一个文件夹下的N个word文件批量执行一个宏?
让宏自动去查找这些word文件,找到后打开,并对其执行指定的宏。
Sub 批量操作WORD()
Dim path As String
Dim FileName As String
Dim worddoc As Document
Dim MyDir As String
MyDir = "G:360data重要数据桌面新建文件夹 (2)" '文件夹路径根据需要自己修改,需要处理的文件都放该文件夹内
FileName = Dir(MyDir & "*.doc*", vbNormal)
Do Until FileName = ""
If FileName <> ThisDocument.Name Then
Set worddoc = Documents.Open(MyDir & "" & FileName)
worddoc.Activate
Call 处理WORD '调用宏,换成你自己宏的名字
worddoc.Close True
FileName = Dir()
End If
Loop
Set worddoc = Nothing
End Sub
'======================下面的宏换成你自己的宏=================================
Sub 处理WORD()
ActiveDocument.Paragraphs(1).Range.Select
Selection.Font.Size = 72
End Sub