Helmut said:
one other, very simple way would be, to define
an autotext entry on the basis of the table,
to insert the table from autotext then,
and possibly remove the autotext entry afterwards.
I don't think you will need a code example for that.
That is probably correct. The problem is that I'm not (yet) comfortable with
autotext.
As of now, I just re-create the table and copy the elements. As shown below.
This is a solution I'm comfortable with. Word might not be comfortable with
it. On the first "working" attempt it crashed. Same on second attempt. Now
I'm worried.
BTW I quit word after every test, so there is little chance that accumulated
errors will unsettle word.
----- code -----
Private Sub Set_letter_header2()
Dim from_rng As Range
Dim to_rng As Range
Dim to_table As Table
Dim from_table As Table
Dim rowC As Integer
Dim colC As Integer
Debug.Print "enter set_letter_header2"
Set from_table = infoDoc.Tables(4)
Set from_rng =
ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage).Range
With ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary)
.Range.FormattedText = from_rng.FormattedText
.Range.ParagraphFormat.LeftIndent = MillimetersToPoints(-15)
.Range.InsertAfter vbCrLf
Debug.Print "5"
set to_rng = .Range
to_rng.Start = to_rng.End
rowC = from_table.Rows.Count
colC = from_table.Columns.Count
to_rng.Tables.Add to_rng, rowC, colC
Debug.Print "6"
'.LinkToPrevious = False
Set to_table = to_rng.Tables(1)
For rowC = 1 To from_table.Rows.Count
For colC = 1 To from_table.Columns.Count
to_table.Cell(rowC, colC).Range.FormattedText =
from_table.Cell(rowC, colC).Range.FormattedText
Next colC
Next rowC
End With
Debug.Print "exit set_letter_header2"
End Sub