Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #16  
Old 04-20-2013, 01:25 AM
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,536
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 dexter30,

The only practical way to do that is with a macro. Try:
Code:
Sub Demo()
With ActiveDocument.Content
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "^13DO[S ]{1,2}VEREADOR*^13DO[S ]{1,2}VEREADOR"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    .End = .Start + InStrRev(.Text, vbCr) - 2
    .Start = .Start + 1
    .Start = .Start + InStr(.Text, vbCr)
    .Text = Replace(.Text, vbCr, " ")
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
End Sub
Notes: The FIND is case-sensitive; if there are any of your other 'Nº [0-9]{1;8}' strings between the 'DO(S) VEREADOR(A/ES)' ranges, they'll be merged with the surrounding 'DO(S) VEREADOR(A/ES)' ranges; and the last 'DO(S) VEREADOR(A/ES)' range in the document won't be processed.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Thread Tools
Display Modes


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 09:34 PM.


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