AllExperts > Experts 
Search      

Active Server Pages Programming (ASP)

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Active Server Pages Programming (ASP) Answers
Question Library

Ask a question about Active Server Pages Programming (ASP)
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Srini 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.
 
   

You are here:  Experts > Computing/Technology > Business Software > Active Server Pages Programming (ASP) > create excel file in asp

Topic: Active Server Pages Programming (ASP)



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")

cnnExcel.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test.xls;Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"""
%>

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.

Happy Programming!

-Srini


Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.