Last row on each page

T

tbaam

I have a macro that copies a number of rows from excel and paste them into
word.
The resulting table spans across multuiple pages in word.

How do I find the last row on each page?

THANKS SO VERY MUCH for your help.
Theresa
 
H

Helmut Weber

Hi,

just the principle, not taking care of _multiple_ tables:

Dim l As Long ' just a counter
Dim p As Long ' a page
Dim r As Long ' a row
p = ActiveDocument.BuiltInDocumentProperties("number of pages")
For l = 1 To p
Selection.GoTo what:=wdGoToPage, _
which:=wdGoToAbsolute, Count:=l
r = r + ActiveDocument.Bookmarks("\page").Range.Rows.Count
MsgBox "Page: " & l & ", Row: " & r
Next

The messagebox tells you, which row in _the_ table
is the last row on the page.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

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