Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search for page break

Status
Not open for further replies.

kittsi

Programmer
Jan 14, 2010
7
0
0
US
I'm trying to search for a page break (a regular page break) in a Word doc through VBA. I have the code to search for a next page break (shown below) it's "^b", but this skips over regular page breaks. Does anyone know the text to search for regular page breaks?

With Selection.Find
.Text = "^b"
.Wrap = wdFindContinue
End With
Selection.Find.Execute
 
What about this ?
.Text = "^m"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi kittsi,

You can't search for an automatic page break, as these are logical constructs determined by the page size, margins and the attached printer. Change printers and the locations of the automatic page breaks might change too.


Cheers
[MS MVP - Word]
 
Thanks PHV! "^m" worked and it found the regular Page Break.

Macropad - you can manually insert page breaks into a document wherever you want, they aren't all necessarily system generated page breaks.
 
Macropad - you can manually insert page breaks into a document wherever you want, they aren't all necessarily system generated page breaks. "

Excuse me, but macropod clearly stated "automatic page breaks".

In fact, your terminology is incorrect. The system generated page breaks are "regular" page breaks.

Manual page breaks are....wait for it...manual page breaks.

Most professional writers avoid using - ever - manual page breaks for precisely the reason macropod states: viewing/printing documents on a computer that has a different printer driver can change how Word lays out pages.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top