I've upgraded to Office 2007 from Office 2003 and am having some trouble getting some software I made that uses the Word Interop to do search and replace working. I changed the reference to the new Interop assembly I got from the Primary Interop Assemblies.
I tried converting my template documents to Office 2007 format, but that didn't seem to help. Everything else seems to be OK but I get an error at sel.Find.Text...
Dim sel As Selection = app.Selection
For Each objRep As ReplaceWord In DirectCast(arrReplaceWords.ToArray(GetType(ReplaceWord)), ReplaceWord())
sel.Find.ClearFormatting()
sel.Find.Text = objRep.OldValue
sel.Find.Replacement.ClearFormatting()
The error I get is...
System.Runtime.InteropServices.SEHException: External component has thrown an exception.
at Microsoft.Office.Interop.Word.Find.set_Text(String prop)
at ContractCreator.ContractGen.btnPrint_Click(Object sender, EventArgs e)
Any one have any ideas on how to fix it
Thanks in advance...