T
Tony Gravagno
I have a Windows Service written in C# that opens the Word application
then opens a document, and starts running macros.
Very frequently the document.open will fail because "for some reason
as yet undiscovered" that document or another will be flagged in the
document recovery process. Opening the document manually shows dialog
"the document 'zzz' caused a serious error the last time it opened.
Would you like to continue opening it?" Well, a Service can't open
dialogs and ask a user what to do with old documents, so the
document.open is stuck, an exception is never thrown, the process
appears to be frozen.
I know I know, serious errors shouldn't be ignored. In this case it
seems to be a data error that throws the VBA into some place that I
have yet to determine. All I want to do is close the doc and the app,
restart the app open a new doc and keep going.
I've seen this question before but never any answer: Can I do
something in the initialization the application or the document
opening that bypasses this process and opens the document from
scratch, ignoring any previous errors?
I'm further concerned that when this stuff happens that an exception
isn't thrown, but there is no document.open timeout either (or maybe I
missed it). If I can get a 5 second timeout on the document open and
then check the doc to see if it's there then I can throw and catch my
own exceptions, but I can't do anything if it's frozen on the open. I
hope the answer isn't to manage this operation in another thread.
Any insight is appreciated.
Thanks!
Tony
TG @ removethispartNebula-RnD
..com
then opens a document, and starts running macros.
Very frequently the document.open will fail because "for some reason
as yet undiscovered" that document or another will be flagged in the
document recovery process. Opening the document manually shows dialog
"the document 'zzz' caused a serious error the last time it opened.
Would you like to continue opening it?" Well, a Service can't open
dialogs and ask a user what to do with old documents, so the
document.open is stuck, an exception is never thrown, the process
appears to be frozen.
I know I know, serious errors shouldn't be ignored. In this case it
seems to be a data error that throws the VBA into some place that I
have yet to determine. All I want to do is close the doc and the app,
restart the app open a new doc and keep going.
I've seen this question before but never any answer: Can I do
something in the initialization the application or the document
opening that bypasses this process and opens the document from
scratch, ignoring any previous errors?
I'm further concerned that when this stuff happens that an exception
isn't thrown, but there is no document.open timeout either (or maybe I
missed it). If I can get a 5 second timeout on the document open and
then check the doc to see if it's there then I can throw and catch my
own exceptions, but I can't do anything if it's frozen on the open. I
hope the answer isn't to manage this operation in another thread.
Any insight is appreciated.
Thanks!
Tony
TG @ removethispartNebula-RnD
..com