运行时让我要选文件,不知道什么意思。。。(不好意思,我很弱的) 我找了老外写的一个,很简单,试了一下满好用的,但是只能执行当前目录下的文件,不能遍历目录下子文件夹的文件,可以修改吗?谢谢! Sub ChangeTemplates() Dim strDocPath As String Dim strTemplateB As String Dim strCurDoc As String Dim docCurDoc As Document strDocPath = "C:\Documents and Settings\administrator\Desktop\folder\" strTemplateB = "D:\Templates\normal.dot" strCurDoc = Dir(strDocPath & "*.doc") Do While strCurDoc <> "" Set docCurDoc = Documents.Open(FileName:=strDocPath & strCurDoc) docCurDoc.AttachedTemplate = strTemplateB docCurDoc.Close wdSaveChanges strCurDoc = Dir Loop MsgBox "Finished" End Sub |