First off: Yes, I know, Word 2007 is "ancient"; I do all my work on a laptop that I bought back in 2012, at a time when I wasn't really keen on trying my luck with the newly released Office 2010 in case it turned out to be riddled with flaws.
Now, putting that aside... After a lot of digging through the Internet and applying the trial and error method, I finally managed to construct a macro in Word 2007 that automatically goes through all Word documents in a folder and resets their styles to match the one in the template they're assigned to, so that I don't have to manually do that for the several hundreds of documents that exist on my computer.
Sub UpdateStylesAllDocuments()
Dim JName As String
Dialogs(wdDialogFileOpen).Show
Application.ScreenUpdating = False
JName = Dir("*.docx")
While (JName > "")
Application.Documents.Open FileName:=JName
ActiveDocument.UpdateStyles
ActiveDocument.Close SaveChanges:=wdSaveChanges
JName = Dir()
Wend
Application.ScreenUpdating = True
End Sub
� It's working as intended... except that for some reason, it refuses to touch any subfolders that exist within the folder that it's working on. What should I add to the above code to fix that?