Split table, maintain repeated column headings

S

Susan Parker

Can I do this?

We have Word tables that are created with SAS as RTF. The long and
short of what we need to do is pull the header and footer into the
body of the document, but we have a table that spans perhaps several
pages and so, we need to split the table onto each page. The column
headings are automatically repeated at the top of each page. So I
want to split the table, but keep the column headings with each split
part.

I'm trying to do all of this with VBA, so we can build it into a
template and automatically process each document.

Any suggestions are greatly appreciated.

Thanks!

Sue
 
S

Suzanne S. Barnhill

It depends what you mean by "split the table."

1. Word will break the table naturally based on your "Allow row to break"
and "Keep with next" settings. Headings (that is, rows that have been
identified as heading rows) will be repeated.

2. If you want to force a break at a specific point, you can format the row
as "Page break before." The table will not be split, and headings will be
repeated.

3. If you insert a manual page break or any other text between rows of a
table, then it is well and truly split, and headings will not repeat.
 
S

Susan Parker

Thanks for responding Suzanne!

I have to split the table. Here's a description of the document.
There is a single table, probably spanning multiple pages. The table
has a heading that is set to repeat at the top of each new (repeat as
header row at the top of each page is checked). In addition to this
the document also has a header and footer, both of which are tables
(because that's the easiest way to get different parts of the text to
justify differently). We need the header and footer real estate back,
so we want to move the document header and footer into the body of the
document. Is it true that to do this and have the former document
header and footer repeat on each page of the document and maintain the
current table heading row, that I will have to split the table on each
page and copy the table header row to the top of each table on each
page, in addition to copying the former document header and footer to
the top and bottom of each page?

I played around with recording a macro to do this for a specific
document, so that I could see more of what I might have to. I figured
that in order to maintain the table rows that are currently on a page
(with the header), that I had to start at the bottom of the table and
split off each page's part that way. I can sort of get it to work.

'go to the bottom
Selection.EndKey Unit:=wdStory

'I want to some how loop doing this
Selection.MoveUp Unit:=wdWindow
Selection.SplitTable

The moveup with wdwindow didn't always take me up to the next page, so
that was a problem when I tried to do the split. But I couldn't
figure out what I could loop through to keep performing the task until
I got to the top of the document or the top of the table on the first
page. How do I check to see what row of what table I'm on or check to
see if I'm at the top of the document? I think I understand how to go
to a particular table in the collection, but how do I check what table
I'm on in the collection?

Does this make any sense?

I can send you an example document of what I would start with and with
what I hope to end up with, if that would help at all?

Thanks!

Sue
 
S

Suzanne S. Barnhill

Okay, here's the fallacy: "We need the header and footer real estate back."
How will you gain anything by moving this material from the header/footer to
the document body? Why not just increase the header/footer space to
accommodate whatever other data you need to put in it? You can put as much
as you like in a header/footer (up to half a page in practical terms), so
you could add text above the existing table in the header. You can add Space
Before/After to that text as needed to distinguish it from the stuff in the
table.

Another approach would be to include the existing header table as one or
more of the heading rows of the existing document table. You can mark as
many rows as you like as heading rows (they just have to be contiguous and
at the top of the table), and all of those rows would repeat on every page.
 
S

Susan Parker

The document header and footer is needed by someone else as they
compile not only my tables together but other parts of a larger
document. If I leave my stuff there, it messes up the Medical Writer
compiling the larger document.

The unfortunate part is that SAS, which is creating my tables to begin
with in RTF, will only put its table titles in the document header and
only put the page footers in the document footer and sets up the table
headings to repeat on each page. Given that I need to do what I have
asked, can I do this with code and if so, do you have any suggestions
for how to go about it?

Should I be posting this in the VBA group instead of here in tables?

Thanks!
 
S

Suzanne S. Barnhill

If you need code, then, yes, you'd be better off in one of the word.vba NGs.
 

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