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
myConnuses the already open Test.xlsx?If it helps, my
connvariable is:"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\Test.xlsx;Extended Properties="Excel 8.0;HDR=No""
All Replies
-
Thursday, September 06, 2012 2:32 PMModerator
Privider does not work with the memory content, but with the file. When you specify file in your connection string, it just openes another instance of the file content and it does not know anything about other opened instances.Val Mazur Microsoft MVP
http://www.xporttools.net- Proposed As Answer by Bob Wu-MTMicrosoft Contingent Staff, Moderator Wednesday, September 12, 2012 8:33 AM
- Marked As Answer by Bob Wu-MTMicrosoft Contingent Staff, Moderator Tuesday, September 25, 2012 2:39 AM
-
Thursday, September 06, 2012 2:40 PMDo you know of a workaround I can use then?
-
Wednesday, September 12, 2012 8:33 AMModerator
Hi jpints,
Base on my knowledge, PIA for Excel can handle opened excel instance.
Best Regards,
Bob Wu [MSFT]
MSDN Community Support | Feedback to us

