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

Discussion in 'ASP General' started by g_mx6, Feb 20, 2004.

  1. g_mx6

    g_mx6 Guest

    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_mx6, Feb 20, 2004
    #1
    1. Advertising

  2. g_mx6

    TomB Guest

    I thought it was called Sheet1?

    "g_mx6" <> wrote in message
    news:...
    > 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.
     
    TomB, Feb 20, 2004
    #2
    1. Advertising

  3. g_mx6

    g_mx6 Guest

    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_mx6) wrote in message news:<>...
    > 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 [Sheet1$]; "
    >
    > 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 'Sheet1$'.
    > Make sure the object exists and that you spell its name and the path
    > name correctly.
     
    g_mx6, Feb 20, 2004
    #3
  4. g_mx6

    g_mx6 Guest

    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
    ----------------------------------------------
    (g_mx6) wrote in message news:<>...
    > 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_mx6, Feb 20, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. zxo102
    Replies:
    3
    Views:
    3,304
    Stuart Corrie
    Aug 9, 2005
  2. Hung Huynh
    Replies:
    8
    Views:
    341
    Bob Barrows
    Sep 24, 2003
  3. fniles
    Replies:
    0
    Views:
    290
    fniles
    Apr 26, 2009
  4. gordon smith

    Excel named range lookup

    gordon smith, Aug 25, 2005, in forum: Ruby
    Replies:
    3
    Views:
    268
    gordon smith
    Aug 26, 2005
  5. TimmyD
    Replies:
    0
    Views:
    191
    TimmyD
    Apr 21, 2005
Loading...

Share This Page