Error opening Excel file 'named range' as recordset in ASP

G

g_mx6

I am not sure what I am doing wrong. I am trying to open a DSNLess
connection and retrieve the data in an Excel sheet using ASP. Shouldnt
be this complicated but I've been trying to get this to work. I have a
named range called Sheet1.
Please assist me in this. Below is the CODE and ERROR.

<%
'************CODE
Dim oConn, oRs

Set oConn = Server.CreateObject("ADODB.Connection")
strOpenConn ="Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\EXPORT.XLS;" & _
"Extended Properties=""Excel 8.0;HDR=Yes"""

strOpenRs = "SELECT Name FROM [Range1$]; "

oConn.Open strOpenConn
Set oRs = oConn.Execute (strOpenRs)

oConn.Close
%>
***************ERROR:
Microsoft JET Database Engine error '80040e37'

The Microsoft Jet database engine could not find the object 'Range1$'.
Make sure the object exists and that you spell its name and the path
name correctly.
 
G

g_mx6

I made a mistake in typing this up on this forum. the named range is
Sheet1 and I wrote Sheet1 but for some reason it does not recognize
it.
 
G

g_mx6

ok. solved it. it was just a permissions problem. I thought that the
issue was that it was not finding the named range.

But although it seemed so, the problem was in fact that the file was
not being read because of permissions. I moved the file to the server
and directly referenced it and it worked fine.

thanks all.
glenn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top