Here is the completed and finalized code to search folders and subfolders and run a macro on every doc, docx, or docm files that it finds.
Sub Recursion()
'enter your root file path here that you want to run this on. LEAVE THE BACKSLASH \ AT THE END
Recurrer "C:\Documents and...
O.M.G. Finally!
After all this time, it works! Tony, if you were next to me, I would give you a friggen hug man. Thanks SOOOOOOOO much for sticking with me and not giving up on me. You have no idea how much this helps!!!!
I really cannot thank you enough!!
Sub Recursion()
Recurrer "C:\Documents and Settings\mmillar\Desktop\test\"
End Sub
Sub Recurrer(Path As String)
Dim DirN As String
Dim DirList() As String
Dim ndx As Long
Dim pos As Long ' added
' Add vbSystem, vbHidden, etc., if you want...
'deleteme' is just a simple find and replace macro.
So this part of the code should be:
Documents.Open filename:=Path & DirN
Application.Run MacroName:="Normal.NewMacros.deleteme"
ActiveDocument.Save
ActiveWindow.Close
Path & DirN = Dir
???
Sub Recursion()
Recurrer "C:\Documents and Settings\mmillar\Desktop\test\"
End Sub
Sub Recurrer(Path As String)
Dim DirN As String
Dim DirList() As String
Dim ndx As Long
Dim pos As Long ' added
' Add vbSystem, vbHidden, etc., if you want...
Sub Recursion()
Recurrer "C:\Documents and Settings\mmillar\Desktop\test\"
End Sub
Sub Recurrer(Path As String)
Dim DirN As String
Dim DirList() As String
Dim ndx As Long
' Dim theFileName As String
' Add vbSystem, vbHidden, etc., if you want such...
Sub Recursion()
Recurrer "C:\Documents and Settings\mmillar\Desktop\test\"
End Sub
Sub Recurrer(Path As String)
Dim DirN As String
Dim DirList() As String
Dim ndx As Long
' Dim theFileName As String
' Add vbSystem, vbHidden, etc., if you want such...
It doesn't work, I'm sorry. That either runs the macro on only the specified file opened, or if I tell it to loop through folders using my previously posted macro, it still will only effect the root folder, and not the subdirectories. That or it gives me an error message about the "DirN = Dir"...
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...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.