Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is it possible to read an Excel file with ADO if the file is allready opened
by someone(for editing)? I think that it should be possible to open the file as read only but I keep getting the error: The Microsoft Jet database engine cannot open the file ''. It is already opened exclusively by another user, or you need permission to view its data. I am running the (javascript asp) code below on an intranet server. The server reads an Excel file on a file server to extract information. Everything works fine unless some user has the file open. I know that this error may occur when there are file permissions errors for in IUSR_computerName user but I am pretty sure I do not have these problems. The errors occur on the line below with conn.Open(). Is there any way I have not used that I can instruct JET OLEDB to open the file as read only. (except for conn.Mode = adModeRead that does not appear to do what I expect it to, to be able to read an open file) My code is as follows: var resRS = Server.CreateObject("ADODB.Recordset"); resRS.CursorType = adOpenKeyset; resRS.CursorLocation = adUseClient; resRS.LockType = adLockReadOnly; var conn = Server.CreateObject("ADODB.Connection"); connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="; connString += "\\\\OtherMachine\\Temp\\test.xls" + ";Extended Properties='Excel 8.0;IMEX=1';"; conn.Mode = adModeRead; // This line generates the error conn.Open(connString); var sql = "SELECT MyName, MyValue FROM [Summary$]"; resRS.Open(sql, conn); Any help most appreciated. Maybe this is something that just cannot be done. Best regards, Andreas Stansvik Software Developer |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel file locked and cannot delete file | Excel Discussion (Misc queries) | |||
file is locked does not appear in Excel if file already open by an | New Users to Excel | |||
locked out of my sheet for read only | Excel Worksheet Functions | |||
"Unable to read file" error message when opening a Excel file that contains a PivotTable report. | Charts and Charting in Excel | |||
Trying to Open Excel File, But its says file is locked for editing | Excel Discussion (Misc queries) |