Check
http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,6b9d4c6f-76bb-4444-8d5b-9e321c605534.aspx HTH
>I have been searching over the weekend for an environment variable that would cause us not to be able to open Excel 2007 via its OLE connection string. If I run my 3 lines of code from the command window or a stand lone prg it works fine. If I run it from within our app I get an error "Database or object is read-only". The file is not read-only and I have started fox and come in fresh a couple of times. I have tried most all of the SET comands we set to no avail. Any ideas on what would make this happen? The sheet in the xlsx file is called "sheet1".
>
>Code:
>
>
>lcConn = "Driver={Microsoft Excel Driver (*.xls, *.xlslx, *.xlsm, *.xlsb) }; DBQ= " + tcFile + ": Provider=Mircosoft.ACE.OLEDB.12.0; Extended Properties=Excel 12.0;"
>
>lnHandle = SQLSTRINGCONNECT( lcConn )
>
>if lnHandle > 0
> lnSuccess = SQLEXEC( lnHandle, "SELECT * FROM [Sheet1$]", "mycursor" )
>ENDIF
>
>SQLDISCONNECT( lnHandle )
>
>
>
>I have tried several variations of the connection string and also have tried opening Excel via the creating of and ADODB.Connection and Recordset and using XmlDom to get teh sheet into a cursor. All fail with read-only error.
_______________________________________________________________
Testing displays the presence, not the absence of bugs.
If a software application has to be designed, it has to be designed correctly!
_______________________________________________________________
Vladimir Zografski
Systems Analyst