matt198992
Technical User
can anyone help me with a microsoft word macro? i am trying to create a macro that runs a second macro across multiple files and subfolders. I got half of it down, to the point where i can execute the macro to all files in a single folder, however cannot get it to search subfolders. here is what i have:
Sub run_macro_on_multiple_files()
'
' run_macro_on_multiple_files Macro
'
'
Dim theFileName As String
theFileName = Dir("FOLDERPATH\*.doc")
Do While Len(theFileName) > 0
ChangeFileOpenDirectory "FOLDERPATH"
Documents.Open FileName:=theFileName
Application.Run MacroName:="FOLDERPATH"
ChangeFileOpenDirectory "C:\Documents and Settings\mmillar\Desktop\test"
ActiveDocument.SaveAs FileName:=theFileName, _
FileFormat:=wdFormatFilteredHTML
ActiveWindow.Close
theFileName = Dir
Loop
End Sub
any help?
Sub run_macro_on_multiple_files()
'
' run_macro_on_multiple_files Macro
'
'
Dim theFileName As String
theFileName = Dir("FOLDERPATH\*.doc")
Do While Len(theFileName) > 0
ChangeFileOpenDirectory "FOLDERPATH"
Documents.Open FileName:=theFileName
Application.Run MacroName:="FOLDERPATH"
ChangeFileOpenDirectory "C:\Documents and Settings\mmillar\Desktop\test"
ActiveDocument.SaveAs FileName:=theFileName, _
FileFormat:=wdFormatFilteredHTML
ActiveWindow.Close
theFileName = Dir
Loop
End Sub
any help?