View Single Post
 
Old 08-06-2023, 03:37 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

The order of the lines actually matters.
The Selection.Find.Execute should be the last line, not the first.

If you cut the selection, the cursor will be showing no selection so that Selection.Find will be working across the whole document. Your code doesn't then paste the cut section back in to the document but even if you added that back in, it likely would go to the location where the last replace happened.

If Selection.Cut is throwing an error, perhaps you have selected something that is protected and can't be removed.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote