Quote:
Originally Posted by ctviggen
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