Free Support Forum - aspose.com

How to close the opening excel file?

For example, I use the code line:
startInfo=new System.Diagnostics.ProcessStartInfo(@“C:\Program Files\Microsoft Office\OFFICE11\EXCEL.exe”,@“E:\Initilization.xls”);
startInfo.WindowStyle=System.Diagnostics.ProcessWindowStyle.Minimized;
process=new System.Diagnostics.Process();
process.StartInfo=startInfo;
to open an excel file and it runs at the background, now I want to close it ,I use the code line: process.close();
but it did not work ,so how to solve this problem ,thank you!

Please try

process.CloseMainWindow();

thank you I have solved this problem