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

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top