Error while trying to access excel file using HTML Code

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi All,

I have developed a web site and I am trying to show some contents on
one of the Web Pages from a Excel file.


I have created a small script but I am getting the error as mentioned
below. Can somebody please help me on this ?


VB Script :
<HTML>
<HEAD></HEAD>
<BODY>
<SCRIPT LANGUAGE="VBScript">
<!--


'## Create Connection and Recordsets
Dim Conn, RS
Set Conn = CreateObject("ADODB.Connection")
Set RS = CreateObject("ADODB.Recordset")
'## The Excel File Name
XLFile = "http://littlemastersachin.com/Documents/Book1.xls";


'## The Data to extract
szSQL = "select * from Events"


'## Create and open the connection
Conn.ConnectionString = "DBQ=" & XLFile & ";DRIVER=Microsoft
Excel
Driver (*.xls);UID=admin;"
Conn.Open
'## set the cursor to be static.
rs.cursortype = 3 ' adStatic.


'## open the recordset
rs.open szSQL, conn


'## Disconnect recordset, eliminate connection
rs.activeconnection = nothing
Conn.Close
Set Conn=nothing


'## iterate through the recordset.
while not rs.eof
response.write RS("name") & " -- "
response.write RS("location") & " -- "
response.write RS("Coordinator") & " -- "
response.write RS("Date") & " -- "
response.write RS("Time") & "<BR>"
rs.movenext
wend


RS.close
Set RS=nothing


-->
</SCRIPT>
</BODY>
</HTML>


When I am opening this page I am getting following error


Line: 28
Char: 5
Error:
Safety settings on this computer prohibit accessing a data source on
another domain.
Code: 0
URL: http://littlemastersachin.com/temp.aspx


.



Relevant Pages

  • Re: Error while trying to access excel file using HTML Code
    ... if you have the html page on the same server as your excel file, ... one of the Web Pages from a Excel file. ... '## Create Connection and Recordsets ... '## Disconnect recordset, eliminate connection ...
    (microsoft.public.scripting.vbscript)
  • Re: Catching an Open Excel File with VBScript
    ... > I am openning an ADO connection with the Excel driver, ... > contents of the file to a recordset. ... > is done loading and I close the Excel file, any time I try to open any Excel ...
    (microsoft.public.excel.programming)
  • Re: Updating Access data using SQL / refresh time question
    ... As a test today, for one poarticular recordset, I changed from DAO to ADO to ... > I forgot to mention that the expense of repeated connection open and close ... > dim oconn as new adodb.connection ... > 'Now load the listview by looping through each RS row ...
    (microsoft.public.vb.database)
  • Re: Updating Access data using SQL / refresh time question
    ... > I forgot to mention that the expense of repeated connection open and close ... > dim oconn as new adodb.connection ... > 'Now load the listview by looping through each RS row ... > ' Set the recordset object each time we load the listview ...
    (microsoft.public.vb.database)
  • Re: Problem: MDB-Datenbank Zugriff über das Intranet
    ... Wie und wo öffnest Du Deine Connection zur *.mdb? ... > End With ... Du öffnest ein Recordset mit adOpenForwardOnly. ... Datensatz liegenden Datensatz zuzugreifen. ...
    (microsoft.public.de.vb.datenbank)