Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-09-2022, 11:04 AM
eludlow eludlow is offline Making all lines following page breaks a particular style Windows 7 64bit Making all lines following page breaks a particular style Office 2013
Novice
Making all lines following page breaks a particular style
 
Join Date: Oct 2014
Posts: 5
eludlow is on a distinguished road
Default Making all lines following page breaks a particular style

Hi there - I have a word Doc that is virtually unformatted. It's just under 700 pages...



However it DOES contain a good number of page breaks (approx 500). I'd like to essentially take the first line after each page break and turn it into a heading, so I can then compile a table of contents based on those "first lines after page breaks".

I feel this should be achievable quite easily, but I'm having a mental blank on how.

Any pointers / suggestions gratefully received.

Thanks in advance.
Reply With Quote
  #2  
Old 01-09-2022, 10:57 PM
gmayor's Avatar
gmayor gmayor is offline Making all lines following page breaks a particular style Windows 10 Making all lines following page breaks a particular style Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Without seeing the document, the following should do that. It searches for manual page breaks and adds the built-in Title paragraph style to the line following the page break. You can format that style however you wish:
Code:
Sub Macro1()
Dim orng As Range
    Set orng = ActiveDocument.Range
    orng.Paragraphs(1).Range.Style = "Title"
    With orng.Find
        Do While .Execute(findText:="^m")
            orng.Collapse 0
            orng.Next.Paragraphs(1).Style = "Title"
        Loop
    End With
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 01-10-2022, 09:46 AM
Charles Kenyon Charles Kenyon is offline Making all lines following page breaks a particular style Windows 10 Making all lines following page breaks a particular style Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,124
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

An improvement might be to add Page-break-before formatting to your Title or Heading 1 style and delete the manual page breaks.
Reply With Quote
  #4  
Old 01-15-2022, 05:59 PM
spillerbd spillerbd is offline Making all lines following page breaks a particular style Windows 10 Making all lines following page breaks a particular style Office 2013
Competent Performer
 
Join Date: Jan 2016
Posts: 130
spillerbd is on a distinguished road
Default

"Heading 1" would be more appropriate.
The default Style of "Title" will not be included in the Table of Contents and would have to be modified for it to.
Charles Kenyon's suggestion to add the Page breaking before the Heading Style is a good recommendation.

@ eludlow I am not a fan of using Manual Page Breaks until working on the Layout of a document. The case in which you have used demonstrates the negatives and doesn't take advantage of Styles.
I would also recommend beginning your document creation by using the Outline View and DO NOT WORRY about formatting till later. Your text formatting should all be done using Styles. This is a huge concern when dealing with large documents when text formatting should be consistent. Example, you wouldn't want long quotes to be formatted different in different sections of a long document. Direct Formatting is convenient, but a horrible opportunity for inconsistencies and problematic updating/changing.

Last edited by Charles Kenyon; 01-15-2022 at 06:13 PM. Reason: typo
Reply With Quote
  #5  
Old 01-15-2022, 06:16 PM
Charles Kenyon Charles Kenyon is offline Making all lines following page breaks a particular style Windows 10 Making all lines following page breaks a particular style Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,124
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

For more support for spillerbd's suggestions, see:
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making all lines following page breaks a particular style Two-line heading in TOC is making two lines of dot leaders betsyg Word 4 06-13-2019 02:18 PM
Making all lines following page breaks a particular style Avoid continous breaks turn into page breaks sponge Word 3 09-14-2017 12:11 PM
Making all lines following page breaks a particular style Hidden page breaks and section breaks jrasicmark Word 3 06-02-2014 11:28 PM
Keep with Next/Keep Lines Together (to adjust page breaks) lewiskm55 Word 1 05-02-2011 08:18 AM
Deleted Section Breaks Changes Page Breaks Brantnshellie Word 0 02-01-2009 09:22 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:14 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft