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

╄→гoц情女王★ 提交于 2019-12-11 01:35:16

问题


This is pretty much exact question of : OleDbConnection() opens an Excel file in any open Excel window. But does not if there isnt a window open, but it had no answers.

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""

来源:https://stackoverflow.com/questions/12300827/oledbconnection-opens-sheet-as-read-only-in-any-open-excel-window

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!