Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 08-08-2012, 04:16 PM
macropod's Avatar
macropod macropod is offline Add Page Break to Document Windows 7 64bit Add Page Break to Document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,381
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi ExpatChic,

Try the following. I had to make some changes to your code, as it wasn't working.
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim vFindText As String, vColor As String, x As Long
With ActiveDocument.Range.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Forward = True
  .Wrap = wdFindContinue
  .Format = False
  .MatchWildcards = True
  'Insert Page breaks before the paragraphs preceding the 'Cat #' paragraphs
  .Text = "[!^13]{1,}^13Cat I"
  .Replacement.Text = "^m^&"
  .Execute Replace:=wdReplaceAll
  'Delete any duplicate page breaks
  .Text = "[^m]{2,}"
  .Replacement.Text = "^m"
  .Execute Replace:=wdReplaceAll
  'Highlight the 'Cat #' paragraphs
  .Replacement.Text = "^&"
  .Replacement.Highlight = True
  For x = 1 To 3
    Select Case x
      Case Is = 1
        vFindText = "Cat I^13"
        vColor = wdRed
      Case Is = 2
        vFindText = "Cat II^13"
        vColor = wdYellow
      Case Is = 3
        vFindText = "Cat III^13"
        vColor = wdPink
    End Select
    Options.DefaultHighlightColorIndex = vColor
    .Text = vFindText
    .Execute Replace:=wdReplaceAll
  Next x
  Options.DefaultHighlightColorIndex = wdNoHighlight
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Add Page Break to Document Delete a page after Section Break Next Page Aston Word 9 04-27-2022 07:38 AM
Add Page Break to Document Page break formatting changes Tom0822 Excel 1 03-19-2012 08:50 PM
Force a page break Emaleth9999 Mail Merge 1 02-09-2012 02:36 AM
paragaph hard break, soft break and ...strange break czomberzdaniela Word 2 12-03-2010 06:58 PM
Page Break Manolo Word 0 04-29-2009 11:04 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:55 AM.


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