I want to read a file created by a VBA-script in Excel and continually edited by this tool with my C#-program (it opens the file every 5 seconds and reads the data). Unfortunately, as soon as I open my program to read from the file, Excel / my VBA-script is unable to write to the file anymore ("access denied").
This is my C#-Code:
System.IO.FileStream fs = new System.IO.FileStream("file.txt",
System.IO.FileMode.Open,
System.IO.FileAccess.Read,
System.IO.FileShare.ReadWrite);
System.IO.StreamReader File = new System.IO.StreamReader(fs);
// read lines from Stream
File.Close();
Is there any possibility to continue writing to the file although it is opened in the C#-tool? I already tried copying the file before opening but I get the same error message.