Relative Content

Tag Archive for vbams-wordreferencefind

Edit VBA to scan a document and pick out the reference numeral that corresponds to a string, e.g. output “102” for “dog 102” in the document

My current code to do this works when all instances of the string in the document are accompanied by the associated numeral. However, where some instances of “dog” arent followed by “102”, but some are, the code fails to return “102”, i.e. doesn’t pick up the reference numeral, instead concluding that no numeral can be found. Here is my code: