Kyle Johnson2 said:My bad
I added some VBA code to the tutorial, so go ahead and use that
- how to change text color from yellow to green in dozens of documents using VBA>
Thanks a ton, it worked!!
Just one more thing—my files are all organized into different folders. Is there any way to swap the colors across all those folders at once instead of me having to manually click through every single one?
Here's what my current code looks like:
Option Explicit
Private Sub ChangeColorText()
Selection.Find.ClearFormatting
Selection.Find.Font.Color = RGB(191, 191, 191)
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Color = RGB(173, 173, 173)
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefhamza = False
.MatchControl = False
.MatchByte = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False end with Selection
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Sub Start()
Dim file
Dim path as String path =
path = "
where the documents are located"
file = Dir(path & "*.docx")
Do While file <> ""
open FileName:=path & file
call ChangeColorText ActiveDocument
Save ActiveDocument
ActiveDocument.Close
file = Dir
Loop
End Sub