Looping through worksheets in an Excel (xls) file using classic ASP on a win 2008 server

Posted by Roy on Stack Overflow See other posts from Stack Overflow or by Roy
Published on 2010-05-30T05:07:39Z Indexed on 2010/05/30 5:12 UTC
Read the original article Hit count: 433

Filed under:
|

Hi,

I have just migrated an older ASP solution to a windows 2008 server and everything works out fine except for using ADOX.Catalog to list all the worksheets in an uploaded xls file. I use the following code:

<% Set objExcelCon = Server.CreateObject("ADODB.Connection") With objExcelCon .Provider = "Microsoft.ACE.OLEDB.12.0" .ConnectionString = "Data Source=" & strFilePath & "\" & strFileName & ";Extended Properties=Excel 12.0;" .Open End With

Set objAdo = Server.CreateObject("ADOX.Catalog")

' Set ADOX activeConnection objAdo.activeConnection = objExcelCon

' Loop through tables (worksheets) For i = 0 To objAdo.Tables.Count - 1 response.Write objAdo.Tables(i).Name Next

Set objExcelCon = Nothing Set objAdo = Nothing %>

When I run this i get no error message or anything. Anyone got any idea whats causing this?

Best regards, Roy

© Stack Overflow or respective owner

Related posts about excel

Related posts about asp-classic