Autocorrect Macro Errors

R

Ryan

Hi,
When running a macro in word 2000 i keep ocasionally
getting the error:

Run-time error '-2147467259(80004005)':
Method 'Add' of object 'AutoCorrectEntries' failed

All i am trying to do is add an entry to the
autoCorrection object.

The line is:

AutoCorrect.Entries.Add Name:="WordLynxDocPrinted",
Value:="0"

It works sometimes but fails others, which makes it
difficult to track the cause.

Any ideas anyone?

Thanks.
 
J

Jezebel

Just a guess, but in general adding an item to a collection will fail if
there is already an item in the collection with that name.

If you are actually trying to update the value, one technique is to delete
the item first, ignoring the error:

on error resume next
AutoCorrect.Entries("WordLynxDocPrinted").Delete
on error goto 0
AutoCorrect.Entries.Add Name:="WordLynxDocPrinted", Value:="0"
 
Top