0

I have an C# program that get input over RS232 and write some data into a text file. Either the text file is created by the program or if it's already exists the data is appended. If some data is written to the text file while it's opened with the editor there is no problem. But if it's written while it's opened with MS Excel the C# program runs into an System.IO.IOException. So obviously MS Excel blocks the file for other access. Is there any possibility to close MS Excel with the C# program if the file is opened with Excel? So to make it clear: MS Excel is not started by the C# program but manually from the user.

Martin G
  • 17,357
  • 9
  • 82
  • 98
Dennis
  • 13
  • 3
  • Try this Example: [Close Excel Application](http://stackoverflow.com/a/17777840/4707863) – David J. Dec 01 '15 at 09:45
  • @DavidJ.That is something different. It is possible to close Excel but if there are multiple instances of Excel open your problem will be determining which one to close. Does it matter if you close all Excel windows? – Fred Dec 01 '15 at 10:11
  • No actually that doesn't matter. But it would be better to only close this one which access my text file. Is the effort in programming a big difference? – Dennis Dec 01 '15 at 10:49

0 Answers0