The other day I wrote a little program to read Excel files through the Jet engine.
I must admit it is fairly simply to accomplish this but I have already stumbled upon an issue.

The Excel files are being used by other people, the program can read these files that are open so that's correct. The issue is that if you have an Excel file open on your computer and you use the software, it will automatically read the locked files and will try to open these Excel files when the user who is using this closes them.

So the locked files are put in a waiting list to be opened and the user is notified that the file is closed and asks if you want to open it.

When the user that is operates the software closes his Excel before executing, the program works fine without opening the locked files...

string connectionString = "Provider=Microsoft.Jet.OleDb.4.0; data source=" + path + "; Extended Properties=Excel 8.0;";
            string selectString = "SELECT * FROM [Debiteuren$]";

            OleDbConnection con = new OleDbConnection(connectionString);
            OleDbCommand cmd = new OleDbCommand(selectString, con);

                OleDbDataAdapter objAdapter1 = new OleDbDataAdapter();
                objAdapter1.SelectCommand = cmd;

                DataSet ds = new DataSet();

                DataTable dt = ds.Tables[0];
                dt = prepareDatatable(dt);
                tableToItems(dt, path);
            catch (Exception ex)