how to do this ? Word file should not quit untill instructed using c#

Dineshkumar.S 456 Reputation points
2022-10-17T11:49:07.35+00:00

Using C# how to achieve this or implement this feature.

For my windows application a word or excel file will open based on the conditions and once opened the user will do some changes in the file like editing and adding a new contents to it and it should not close automatically we need to stop closing the environmental file which is already opened and it should be opened till the last step of instructions.

Can anyone suggest me any ideas for this and it will be helpful for me.
Thanks in advance.

Developer technologies | Windows Forms
Developer technologies | .NET | .NET CLI
Developer technologies | C#
{count} votes

1 answer

Sort by: Most helpful
  1. Rijwan Ansari 766 Reputation points
    2022-10-20T11:59:55.457+00:00

    Hi,

    You can open a word or Excel file using condition, and it will not close automatically.

    if (condition)  
    {  
       this.Application.Documents.Open(@"C:\Test\NewDocument.docx");  
    }  
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.