Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-11-2023, 11:31 AM
ctviggen ctviggen is offline Delete empty lines Windows 10 Delete empty lines Office 2016
Advanced Beginner
 
Join Date: Feb 2021
Posts: 54
ctviggen is on a distinguished road
Default

Not directly related, but why can you also put the execute replace statement outside the with...end with "loop"?





In other words, this:


Code:
Sub Macro1()     With Selection.Find         .ClearFormatting         .Replacement.ClearFormatting         .Text = "^13{2,}"         .Replacement.Text = "^p^p"         .Forward = True         .Wrap = wdFindContinue         .Format = False         .MatchCase = False         .MatchWholeWord = False         .MatchAllWordForms = False         .MatchSoundsLike = False         .MatchWildcards = True         ' .Execute Replace:=wdReplaceAll     End With
    Selection.Find.Execute Replace:=wdReplaceAll End Sub

Does the Selection.Find just find everything...but do nothing until the execute? If so, why don't you HAVE to put the replace all outside the loop?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete empty lines A way to delete when 2nd column is empty gavi12 Word VBA 1 04-04-2020 05:42 AM
Delete empty lines Delete row with empty cel in a table vibor Word VBA 9 05-03-2015 05:42 AM
Delete empty lines Remove empty lines at the top of every page dexter30 Word VBA 2 08-05-2013 08:37 PM
regular expressions for empty lines eNGiNe Word 1 01-21-2013 06:38 AM
Deleting empty lines lostsoul62 Word 5 04-16-2012 04:55 AM

Other Forums: Access Forums

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