Quote:
Originally Posted by joewoods
Thanks Pete! Yup, that worked!!
|
Umm, hello - I'm not Pete...
Quote:
Originally Posted by joewoods
I just realized that the previous macro for the text color is only changing the font color in the header that is on the first page. Each page has a table withing the header (with different characters in it), and the macro doesn't seem to be getting the characters in the tables past the first page. Is there a way to fix this?
|
Try:
Code:
Sub UpdateDocuments()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, wdDoc As Document, Rng As Range, Sctn As Section, HdFt As HeaderFooter
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.docx", vbNormal)
While strFile <> ""
If ThisDocument.FullName <> strFolder & "\" & strFile Then
Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
With wdDoc
For Each Rng In .StoryRanges
Rng.Font.ColorIndex = wdBlack
Next
For Each Sctn In .Sections
For Each HdFt In Sctn.Headers
With HdFt
If .LinkToPrevious = False Then .Range.Font.ColorIndex = wdBlack
End With
Next
For Each HdFt In Sctn.Footers
With HdFt
If .LinkToPrevious = False Then .Range.Font.ColorIndex = wdBlack
End With
Next
Next
.Close SaveChanges:=True
End With
End If
strFile = Dir()
Wend
Set wdDoc = Nothing
Application.ScreenUpdating = True
End Sub
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function