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

Dineshkumar.S 451 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.

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,869 questions
.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
326 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,582 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Rijwan Ansari 746 Reputation points MVP
    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");  
    }