Split table and copy a Table Header between both table

A

Alex St-Pierre

Hi!
I would like to split a table into 2 pages and copy a new Header just before
the new table created (which is on the next page). So, I tried:
iRowSplit = 20
tbl.Rows(iRowSplit).Range.InsertBreak (wdPageBreak)
iP = docWord.Range(0, tbl.Range.End).Paragraphs.Count
iP = iP + 1
Set oRange = docWord.Paragraphs(iP).Range
oRange.Text = "My Header (continued)"
For any iP, it seems to be impossible to write text between table #1 and
table #2?
Any idea?
Thanks a lot!
Alex
 
S

Stefan Blom

There might be better ways to do this in VBA, but the following should work:

tbl.Rows(iRowSplit).Range.InsertBreak wdPageBreak

Set r = ActiveDocument.Range(0, tbl.Range.End + 1)

r.InsertAfter "My Header (continued)"

Note that in the user interface, you could use a heading row and then add
"Page break before" formatting to row number iRowSplit; this would break the
table without splitting it. You would then have to add a white graphic to
hide the "(continued)" text on the page where the table starts.

--
Stefan Blom
Microsoft Word MVP


in message
news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top