View Single Post
 
Old 01-23-2023, 07:02 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,975
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

You need to look at the invisible characters in your text file.
sFind = "Ampac
implies that following the word Ampac is something else, like a new line rather than " Warranty". I would expect it to be showing
sFind = "Ampac Warranty"

You can add a Watch to the sFind variable to monitor its value is while the macro is running.

The macro assumes that the search terms are separated by a vbCrLf which translates to a Carriage Return/Line Feed in a text file. If your text file contents is structured differently to what the macro assumes then the code will need to be adjusted to correctly deal with the ACTUAL contents of the text file rather than the assumed contents.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote