My MS Word has a COM non-standard add-in (DIRECTUM), which "grabs" an open file with its process. I do not know why.
If you close the file in the shell of Word, then everything will be fine. If the work file is opened in OleContainer :

 oc1.CreateObjectFromFile(LMDLabel1.Caption,false); 

then

 oc1.Close; oc1.DestroyObject; 

then the add-in process does not end. After the completion of my program, a COM error message is displayed and a file with a tilde remains in the directory.
What needs to be done so that the file in OleContainer correctly as in the Word shell?

    1 answer 1

    Found an example , can help:

     var SaveChanges: OLEVariant; OriginalFormat: OLEVariant; RouteDocument: OLEVariant; begin SaveChanges := wdDoNotSaveChanges; OriginalFormat := unAssigned; RouteDocument := unAssigned; oc1.Quit(SaveChanges, OriginalFormat, RouteDocument); end;