Using the find object in Word 11 COM object

  • Thread starter Thread starter JeffOfJersey
  • Start date Start date
J

JeffOfJersey

I'm trying to develop a dotnet application that uses the Word 11 com object.
Whenever I try to use the find object I get a blow out.

In the code fragment below executingthe ClearFormating method I blow out
with "An unhandled exception of type 'System.ArgumentException' occurred"

Dim myRange As Word.Range = oWord.ActiveDocument.Content
With myRange.Find

..ClearFormatting()

..Replacement.ClearFormatting()

..Text = "hello"

..Replacement.Text = "goodbye"

..Execute(Replace:=Word.WdReplace.wdReplaceOne)

End With



Has anyone been able to use the Word 11 find object in a VB dotNet program?



Thanks,

Jeff Morrison
 
Back
Top