Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 04-11-2023, 12:24 PM
Italophile Italophile is offline Delete empty lines Windows 11 Delete empty lines Office 2021
Expert
 
Join Date: Mar 2022
Posts: 554
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Quote:
Originally Posted by ctviggen View Post
Hmm...not sure why that looks bad. Anyway, the Replace:=wdReplaceAll is outside the original with..end with "loop", instead of being inside the loop.
Firstly, there isn’t a “Loop” in your code, nor is there an “End With”

“With … End With” is referred to as a “With Block”, and is an efficient way of referring to an object without having to repeat the object each time you set a property.

“Selection.Find” does not do anything until the “.Execute”, which may be within the With block or outside it, especially if it is being called inside a loop, in which case it would appear as
Code:
Do While Selection.Find.Execute
    ‘Do stuff
Loop
Reply With Quote
 



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:17 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