Hi all,
Customer has a LOT of templates where from data in the database into a Word template. I have used two techniques - one uses a bookmark to indicate the location to insert the data and have also used merge fields to insert the data. A fair bit of the overall coding was done in 2008 based on the Office Automation book by Tamar and Della Martin. Overall the customer is really happy and it is heavily used to this day.
But users experience occasional problems with the process (a few times a month, various users). I use a TRY/CATCH so they don't get an outright crash and I just throw up a dialog for them to try again. In the past I have just told them that it is due to "general Word flakiness" (which might be true) which is what I have thought and so I did not log the error in detail anywhere. Recently I decided to log the error to try to track this down.
Here is the general process (abbreviated, most error trapping removed):
loBookmark = THIS.GetBookmark(lcBookmarkName,toDocument)
loRange = loBookmark.Range
loRange.InsertAfter(lxBookmarkData)
Now that I am logging it, here is the error information:
OLE IDispatch exception code 0 from Microsoft Word: This method or property is not available because this command is not available for reading...
AERROR() contents:
Cell 1: 1429
Cell 2: CMD1.
Cell 3: This method or property is not available because this command is not available for reading.
Cell 4: Microsoft Word
Cell 5: wdmain11.chm
Cell 6: 37373
Cell 7: 4605
How can I get more details on this error - the wdmain11.chm file does not exist anywhere (that I could find) so I can't look up the details (if they even exist in the .chm file).
Any other way to get more information back from OLE that I could maybe capture after the error?
Albert
Bear in mind that this process is probably fired a few thousand times a month and I usually get a couple emails a week or less). Templates have not changed before or after.