Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Handling errrors in automation better
Message
De
22/05/2019 01:55:26
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
À
21/05/2019 15:02:14
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01668779
Message ID:
01668795
Vues:
56
>
loBookmark = .GetBookmark(lcBookmarkName,toDocument)
>
>That method handles cases of no bookmarks in the document or the specified bookmark not being found (mispelled or removed from the template etc). It returns an object reference or null. So my calling code just has to check for null.
>
>
>IF NOT ISNULL(loBookmark)
>
>   * get the range object for the bookmark
>   loRange = loBookmark.Range
>
>   * and then insert the data using the ranges .InsertAfter() method:
>   loRange.InsertAfter(lxBookmarkdata)    && lxBookmarkdata = data worked up in form
>
>
>and so I see occasional errors on this last line; in this case it was error 1429 with the message "OLE IDispatch exception code 0 from Microsoft Word: This method or property is not available because this command is not available for reading..."
>
>But why does this happen? I have checked and/or trapped that I have a bookmark object before this happens but I still get an error probably about once every 100-500 runs of this code. Of course the above code does not trap if the range object is somehow not correct - but that should exist if the bookmark exists.
>
>Any thoughts on the above?

Beats me. I was experiencing such things for years. Things that work hundreds of times a day would suddenly become "unavailable" or "does not exist", "not found" etc for a few cases in a batch, while working fine for the rest of the batch. Why? Because I was trying to use automation.

Solution? Avoid it.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform