The following macro run as a custom process from
http://www.gmayor.com/document_batch_processes.htm
to handle the folder allocations will change the text in the cell to that indicated in the function. It assumes that if a 2x2 table exists in any header in the document it will be processed.
Code:
Function UpdateHeader(oDoc As Document) As Boolean
Dim oSection As Section
Dim oHeader As HeaderFooter
Dim oTable As Table
Dim oCell As Range
On Error GoTo err_Handler
For Each oSection In oDoc.Sections
For Each oHeader In oSection.Headers
If oHeader.Exists = True Then
If oHeader.Range.Tables.Count = 1 Then
Set oTable = oHeader.Range.Tables(1)
If oTable.Rows.Count = 2 And oTable.Columns.Count = 2 Then
Set oCell = oTable.Cell(1, 1).Range
oCell.End = oCell.End - 1
oCell.Text = "The new text for the cell"
End If
End If
End If
Next oHeader
Next oSection
UpdateHeader = True
lbl_Exit:
Set oSection = Nothing
Set oHeader = Nothing
Set oTable = Nothing
Set oCell = Nothing
Exit Function
err_Handler:
UpdateHeader = False
GoTo lbl_Exit
End Function