Howto avoid Word Automation closed by user

LouisLouis Member Posts: 78
During the send e-mail process (mail merge), the user sometimes opens the attachment generated by Navision, to verify if it's ok for him.
Unfortunately, if the user closes the Word Application (instead of the current Word Document), the Navision process crashes ! because the Word Instance is closed.
Is it a way, a property in Word, or an idea in your head... to avoid this situation.

TIA,
Louis

Comments

  • krikikriki Member, Moderator Posts: 9,110
    Make the Wordautomation invisible.
    I think it is like this: autAutomation.VISIBLE(FALSE);
    Then start processing and at the end make it visible again.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • LouisLouis Member Posts: 78
    Thank you. I know this property.
    But when the e-mail process shows the attachment I think it's still possible for the user to open the Word Application by clicking the attached Document and if he close the application instead of closing only the document the following message appears :

    => This message is for C/AL Programmers :
    = >Could not invoke the member Documents. The OLE control or Automation server returned an unknown error code.

    Do you know if it is another approach to resolve this problem ?
    Do you know if it is possible to trap an error code in C/AL and reopen Word ?
    TIA
    Louis
  • garakgarak Member Posts: 3,263
    you can check if the WordInstance is loaded or not. If there is no word appl. open, create a new WordApp.

    Regards
    Do you make it right, it works too!
  • ajhvdbajhvdb Member Posts: 672
    You can prevent userinput in Word but you can't prevent the X (Close).

    Can't you teach the user?
Sign In or Register to comment.