![]() |
|
|||||||
|
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Thanks Pete! Yup, that worked!!
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? |
|
#2
|
||||
|
||||
|
Umm, hello - I'm not Pete...
Quote:
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
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
So sorry Paul!! My office mate is Pete!! I am doing a million things at once. Please accept my apologies. Will try running the new code right now and let you know.
|
|
#4
|
|||
|
|||
|
Hey Paul,
I'm trying this code, but I'm finding that it's not able to capture the content in the header tables after a page/section break. Can you please help with this? |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Run a macro on multiple docx. files
|
Peter Carter | Word VBA | 27 | 12-15-2022 04:10 PM |
| I can't change red text to black | Nathan8752 | Word | 1 | 10-12-2015 08:26 AM |
macro to change name of files in a folder in order
|
expert4knowledge | Word VBA | 5 | 07-10-2014 03:54 PM |
Word Macro - change date in footer for all files in a folder
|
patidallas22 | Word VBA | 2 | 03-09-2012 08:14 AM |
| Change cell color everytime a value is selected in dropdown list | angelica_gloria | Excel | 4 | 01-27-2012 06:47 PM |