I'd like to loop through all .docm files in a directory (call it C:\Work for example), open the document, and perform some action on each file in the directory.
What code can accomplish this? I know it is simple as can be in excel but I have had trouble finding analogous word examples.
The action I want to perform is irrelevant but I included it in code tags below.
Sub Update()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "June"
.Replacement.Text = "July"
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "May"
.Replacement.Text = "June"
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "April"
.Replacement.Text = "May"
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Thanks in advance,
-Michael
Bookmarks