Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #29  
Old 05-05-2013, 05:23 PM
macropod's Avatar
macropod macropod is offline Format text automatically Windows 7 64bit Format text automatically Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

Try the following:
Code:
Sub Reformat()
Application.ScreenUpdating = False
Dim i As Long, RngFnd As Range
With ActiveDocument
  Set RngFnd = .Range
  With .Range
    With .Find
      .ClearFormatting
      .Replacement.ClearFormatting
      .Forward = True
      .Wrap = wdFindStop
      .MatchWildcards = True
      .Text = "[^13]{1,}D[ao][s ]{1,2}Vereador*^13"
      .Replacement.Text = ""
      .Execute
    End With
    RngFnd.Start = .Start + 1
  End With
  With RngFnd
    With .Find
      .ClearFormatting
      .Replacement.ClearFormatting
      .Forward = True
      .Wrap = wdFindStop
      .MatchWildcards = True
      .Text = "[^13]{1,}"
      .Replacement.Text = "^p^p"
      .Execute Replace:=wdReplaceAll
      .Text = "[ ]{1,}^13"
      .Replacement.Text = "^p"
      .Execute Replace:=wdReplaceAll
      .Text = "[^13]{1,}(D[ao][s ]{1,2}Vereador*)([^13]{1,})"
      .Replacement.Text = "^p\1^l"
      .Execute Replace:=wdReplaceAll
      .Text = "[^13]{1,}(Nº)"
      .Replacement.Text = "^p^l\1"
      .Execute Replace:=wdReplaceAll
      .Text = "[^13]{1,}(MATÉRIA DO LEGISLATIVO)[^13]{1,}"
      .Replacement.Text = "^p^l\1^l^p"
      .Execute Replace:=wdReplaceAll
      .Text = "[^13]{1,}(INDICAÇÕES)[^13]{1,}"
      .Replacement.Text = "^p^l\1^l^p"
      .Execute Replace:=wdReplaceAll
      .Text = "[^13]{1,}(MOÇÕES)[^13]{1,}"
      .Replacement.Text = "^p^l\1^l^p"
      .Execute Replace:=wdReplaceAll
      .Text = "[^13]{2,}"
      .Replacement.Text = " "
      .Execute Replace:=wdReplaceAll
      .Text = "^l"
      .Replacement.Text = "^p"
      .Execute Replace:=wdReplaceAll
      .Text = "[^13]{1,}(D[ao][s ]{1,2}Vereador*)([^13]{1,})"
      .Replacement.Text = "^p^p\1^p"
      .Execute Replace:=wdReplaceAll
    End With
  End With
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
Macro to find text in between two characters and then format selected text? qcom Word 5 02-19-2015 11:23 PM
automatically format meetings by me with some attendee wsw70 Outlook 0 06-24-2011 12:16 AM
Objective: Automatically export email text,attachment text to DB friendly format SilentLee Outlook 0 11-14-2010 02:45 PM
automatically extract footnotes into new file and apply character format to footnote hrdwa Word 0 02-27-2010 03:16 AM
format cells to automatically place quotes around text dirtleg Excel 1 09-16-2008 01:52 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:42 PM.


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