Problem finding end--of-page using tables

A

Art Yates

I am using VB6 to create a word XP document consisting of several tables.
The document may end up being 300+ pages.

I want two things:
1. Constant header on the first line of every page of the table
2. Add my own headers to mark the beginning of a new country (bold and a
toc entry)

Using: Selection.Information(wdActiveEndPageNumber) or
Selection.Information(wdNumberOfPagesInDocument)
does not reliability tell me when I am at the end of a page.

Often, it would tell me that the page has changed 2 to 5 table rows into the
next page.

So, I tried: points= ActiveDocument.Tables(1).Rows.DistanceBottom
and always go the answer 999999

So then I tried, LinesOnPage= ActiveDocument.Tables(1).Rows.count
assumed a certain number of LinesPerPage and created a new table on every
page.

If I adjust the LinesPerPage so that I do not have any overrun from page to
page,
I will end up with several pages with unused space at the bottom. Since this
is a fairly
big book, I would like to use most of the space.
 
J

Jezebel

You can do the constant header by selecting the first row, then going to
Table > Properties. On the Row tab, check the 'Repeat as header row at the
top of each page' checkbox. If you don't want this repeating row at the
start of the table, draw a white rectangle over the top of it, anchored to a
paragraph outside the table.

Don't understand your question is in respect of adding your own headers. How
does this relate to what page you're on?

If the Information() function appears to be returning the wrong value, then
you are testing the wrong thing. Don't use the Selection object. Test the
Range of the first cell in the row.

Control the page breaks with judicious use of 'Keep with next' and 'Allow
row to break across pages'.
 
A

Art Yates

Thanks for your comments, in answer to your questions:
On the Row tab, check the 'Repeat as header row at the
top of each page' checkbox.

What is this in VBA? I want this at the top row.
Don't understand your question is in respect of adding your own headers. How
does this relate to what page you're on?

The data is organized by Country. When the country changes, I insert a row
with a header 2 style
so that the table of contents will show the country break. When the page
breaks, and there
are more aircraft in that country, I make the country the second line of the
table to show
the continuation of the country on the next page -- this gets a style of
Normal and is bolded, so that
the TOC entry is not repeated. I need to know how many table rows are on a
page, so that
I can to the page break correctly with out too much empty space at the
bottom of a page.

I stopped using the Information() function. I am getting better looking
results with Table.Rows.count,
except for the extra spaces at the end of a page. I am trying to break 2
lines before the end of the
page, but in varies from 20 to 2. With a 300+ page book, this is a lot of
wasted space.
Each page gets it's own table, and I have a constant RowsPerPage. Since not
all rows are created equal
(detail lines are Arial 5, country headers are Arial 7), I try to adjust the
RowsPerPage to accommodate the
size of the rows that were written.

Art Yates
(e-mail address removed)
 
J

Jezebel

Can't remember what the property is for the repeating header row, but if you
can't find it through the object browser or the documentation, you're out of
your depth here anyway.
 

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