Hi people,
I am trying to do something that should be easy but for the life of me I cannot figure this out.
I want to be able to find a text string in a Word document (from Excel VBA) between two specific words (these two words are always the same but the string may vary) and store that text string as a variable.
After some research I found this post which I tried to adapt to my needs:
http://www.ozgrid.com/forum/showthread.php?t=149126
But when I try to execute this code (slightly adapted but no major changes) I get the following error:
Run-time error '5560':
The Find What text contains a Pattern Match expression which is not valid.
Somehow the "*" Wildcard is stopping the code from working, but if I leave it out the next error I get at the next line of code is
Run-time error '4120':
Bad parameter
You can see the code I am using below:
It might be heplful to mention that the starting word is "OTRA, " (notice the blank space at the end) and the ending word is "," (comma at the end of the 'target' text)
I am completely lost
Can someone point me in the right direction?
Bookmarks