Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2007

Tip: Looking for answers? Try searching our database.

Page Break problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
vbaNOOB - 30 Mar 2007 05:26 GMT
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
Helmut Weber - 30 Mar 2007 13:51 GMT
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

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.