AboutSrini Nagarajan Expertise I can answer any kind of questions in ASP.NET, C#, VB.NET, SharePoint 2007, ASP, Coldfusion, Powerbuilder 7.00 / 8.00, JAVA servlets, MS SQL 2000 / MSSQL7, Sybase
Experience Contact me if you need any custom development on ASP.NET, ASP, SharePoint 2007, Coldfusion, Powerbuilder.
Expert: Srini Nagarajan Date: 7/2/2005 Subject: create excel file in asp
Question Sir i m using the following code:
<%
Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
xml.Open "GET", "http://localhost:81/ankit/test.htm", False
xml.Send
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fname=fs.CreateTextFile("c:\test.xls",true)
fname.WriteLine xml.responseText
fname.Close
set fname=nothing
set fs=nothing
response.write a
Set xml = Nothing
%>
This code creates excel file successfully.But i use to conncet this excel file using
<%
Set cnnExcel = Server.CreateObject("ADODB.Connection")
It gives an error :External table is not in the expected format.
But when i open and save then it ask the location for save (why i dont know.?).Then i save it again on the same location i.e. C:/
Now After saving i m successfully connceted to excel file and can make a query.But after saving it manually.Can you please tell me why this file is not saved in C: when i using the above code.
I am trying it from last three days and get rid of.Please give me some solution as soon as possible.I vl be highly obligue to you.Its very urgent.
Regards
Ankit jain
Answer Hi
You need to give necessary write permission to the IUSR and IWAM in the c: what ever folder its going to be..
and if you write the xls file it needs in write format, you can't write a HTML file into XLS file.