OleDbConnection opens sheet as read-only in any open Excel Window

Answered OleDbConnection opens sheet as read-only in any open Excel Window

  • Thursday, September 06, 2012 2:12 PM
     
     

    If I have multiple Excel windows open, my program will open a read-only sheet in any Excel window. I.e. if I have Test.xlsx open, and a blank sheet in another window (let's say my program wants to write to Test.xlsx); when I do:

    OleDbConnection myConn = new OleDbConnection(conn);

    myConn.Open();

    a read-only copy of Test.xlsx will open in the blank window, and the program will operate on that. Is there a way to ensure that myConn uses the already open Test.xlsx?

    If it helps, my conn variable is:

    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\Test.xlsx;Extended Properties="Excel 8.0;HDR=No""

All Replies