Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
After updating in excel, there is a requirement of closing the Workbook Immediately.
if I write Environment.Exit(),Than it closes immediately but soon after opening again the same excel application.I tried with Globals.ThisWorkBook.Close(0) ; too this also closing application related sheet but manually have to go again and close the plain excel.Please help me to close the Workbook after update happens.

My Application windows based app with VSTO assemblies(excel)

What I have tried:

1.Environment.Exit();
2.Globals.ThisWorkBook.Close(0) ;
Posted
Updated 6-Jun-22 23:52pm

1 solution

 
Share this answer
 
Comments
Thirumadhi T Johnson 7-Jun-22 7:39am    
So do I need to add this line of code public void Quit (); after updating so that it will close my excel workbook immediately !!!
Richard MacCutchan 7-Jun-22 8:51am    
You need to close the workbook first; this function closes the Excel application.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900