Page Break problem

V

vbaNOOB

Hi,

How can I detect if a paragraph is at the beginning of a page in a doc??

I know there is couple of kind of page break in word, mannul page break(^m),
section break(^b), also the break the that when the text exceed the page
(auto insert by word). how can I search those break?

Many Thanks
 
H

Helmut Weber

Hi vbaNOOB,

like this, in a way, which may not be exactly what you want,
but then, what do you want exactly? ;-)

(I hate "exactly", there seems to be always room for interpretation.)

Maybe a loop over all pages and check,
whether they start with a paragraph,
which starts with that page?

Note, the first paragraph on a page
may start on the previous page.

And it may continue over several pages.

Sub Test400()
' question:
' is the first letter of the first paragraph
' of the page the start of the selection is on
' the first letter of the page?
Dim x As Long
Dim y As Long
With ActiveDocument.Bookmarks("\page").Range
x = .Paragraphs(1).Range.Characters.First.start
y = .Characters.First.start
End With
If x = y Then
MsgBox "Yes"
Else
MsgBox "no"
End If
End Sub

HTH

--
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