I have an application that automates MS Word. The app functions properly with Word 2000 but when run on a system with Word XP it faults.
Here is a snippet of the problem code.
Set SoapNote = New Word.Application
Set SoapDoc = SoapNote.Documents.Add(TemplateName) 'Code Faults here
With SoapNote.Selection.Find 'Code Faults Here
.ClearFormatting
.Text = SearchField(x)
.Execute Forward:=True
End With
With Clipboard
.Clear
.SetText ReplacementText(x)
SoapNote.Selection.Paste
.Clear
End With
In design Mode running the Project generates a run time
error -2147221163(80040155)
Method 'Find' of object 'Selection' failed.
I have tried creating a new object of type
(Word.Application.Selection) If I change the code
accordingly to access methods of the selection object I
get an error on the line I am trying to set the Object
Reference.
What is different in 10.0 and what should I do in my code
to accomodate these changes.
Thanks
P.S. BUG: Automation Client Receives Error Calling Word Find
Object [Q292744] This KB Article addresses a similar problem, but does not fix the issue.