Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 06-24-2017, 08:38 PM
eduzs eduzs is offline Replacing till there's no more double paragraphs in the text Windows 10 Replacing till there's no more double paragraphs in the text Office 2010 32bit
Expert
Replacing till there's no more double paragraphs in the text
 
Join Date: May 2017
Posts: 266
eduzs is on a distinguished road
Default

Thanks for helping, based on your idea we got a workaround to this "bug":

Now I can get rid of unwanted paragraphs breaks and repeated blankspaces.

Code:
Sub Limpa_texto()

Dim i As Integer, oRng As Range, aProc, aSubs

aProc = Array("^13{2;}", "^32{2;}", "^13^32")
aSubs = Array("^p", " ", "^p")

Set oRng = ActiveDocument.Range

Do While Len(ActiveDocument.Range.Paragraphs.Last.Range) = 1

    ActiveDocument.Range.Paragraphs.Last.Range.Delete

Loop

Application.ScreenUpdating = False

For i = 0 To UBound(aProc)

    With oRng.Find

        .Text = aProc(i)
        .Replacement.Text = aSubs(i)
        .Forward = True
        .MatchWildcards = True
        .Wrap = wdFindContinue
        .Execute
        
    End With

    Do While oRng.Find.Found

        oRng.Find.Execute Replace:=wdReplaceAll

    Loop

Next i
    
Application.ScreenUpdating = True

End Sub
__________________
Backup your original file before doing any modification.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Replacing till there's no more double paragraphs in the text Help with replacing text with wildcards sbatson5 Word 2 04-13-2012 03:49 AM
Why the "Text boundaries" are not shown till the end of the page while in other file Jamal NUMAN Word 4 03-28-2012 07:58 AM
Replacing till there's no more double paragraphs in the text outlook double spacing paragraphs GWBDIRECT Outlook 3 04-06-2011 11:29 AM
Replacing till there's no more double paragraphs in the text Replacing a single "l" with a double "ll" MShroff Word 8 01-19-2011 08:43 AM
Replacing / editting text LisaC Word 0 02-25-2010 03:40 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:50 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