Hi Jon,
I think I've got it. While yesterday it seemed impossible, I have found the way around the many obstacles. :-)
The script had to be rewritten completely, because the replaced SKU numbers have to be marked with a color.
The job has been quite difficult: The Excel file has two columns with 9500+ numbers each. The numbers consist of five to eight digits. And a few are followed (or preceeded) by one or two letters, like "WS".
The XPress project must be opened, Excel must be running. Then drag and drop the Excel file on the icon of the droplet.
When nothing is selected, all stories of the document are treated. The script checks if the current story contains one SKU number, at least.
When a text box is selected, only the numbers contained in that box are replaced. And when some text is selected, the script tries to replace the numbers of the selection.
The script needs the Scripting Addition "Satimage.osax" for locating the positions of the numbers. For each "old" number the new one is extracted from the list. Then the script replaces the number and applies a red color.
This evening I'll test it with the eight-pages document. And then I'll send you the droplet with some more explanations.
Best regards, Hans