Hi All,
I have inherited some VB.Net code that uses Office Interop to automate some tasks in Word; it's all working well apart from the find & replace part. We have a setup where there may be multiple instances of special keywords embedded in the template document
which are found and replaced by the VB.Net application (e.g. "~CASE_REF~" will be replaced by "ABC123"), and all is fine unless any of the keywords are in the document footer in which case it appears they are neither found nor replaced.
The code in question is:
Do While docWord.Content.Find.Execute(FindText:=adoVRset.GetValue(intPos).ToString(), MatchCase:=False, MatchWholeWord:=False)
docWord.Content.Find.Execute(FindText:=adoVRset.GetValue(intPos).ToString(), ReplaceWith:=adoVRset.GetValue(intPos + 1).ToString(), MatchCase:=False, MatchWholeWord:=False, Forward:=Word.WdReplace.wdReplaceAll)
Loop
Sorry - I cannot format the code to a code block; it either only does half of the selected code or else it formats the entire post. It really isn't my day.
If anyone knows why this is failing to work for keywords in the footer I'd be very grateful for any pointers.
Thanks in advance.
Tony.