Word 2003 - Automation Error No. -196859 objSelection.Find.Execute

T

T Scott

I have a a VB5 application that fails with:
Automation Error No. -196859

This error ONLY happens when automating Word 2003 - The code works fine
with all other versions of Word.

The code (variables have been replaced with strings for illustration of this
example) that fails is:

objSelection.Find.Execute _
FindText:="[[ContactName]]", _
ReplaceWith:="<Attention>", _
replace:=wdReplaceAll

The error has been emulated on multiple machines with Windows XP and Word
2003 with the latest updates.

In the routine being executed there is a previous execution of the
"objSelection.Find.Execute" on the Content of the document. This first
execution works without error. Then the code executes the
"objSelection.Find.Execute" again on the first Header of the first Section
of the document. This is where the failure occurs.

The error occurs whether there is a target FindText in the header or not.

What could be causing this Automation Error?

TIA
Tony Scott
 
T

T Scott

This looks like a bug in Word 2003's handling of .Find.Execute on the
Selection object within the header object within the section object.

I changed the logic to do the .Find.Execute on the Range object and it now
works.

Tony Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top