Problem Creting Excel .xls file from ASP

Results 1 to 3 of 3

Thread: Problem Creting Excel .xls file from ASP

  1. #1
    Mark Guest

    Default Problem Creting Excel .xls file from ASP

    I have the following VBScript, but it does not create an .xls file and the page eventually times out. I have tried setting project references for Excel and get the same result. Any ideas as to what is wrong ?<BR><BR>"<BR>Dim xlApp, xlBook, xlSheet<BR>Dim strFileName<BR><BR>strFileName = "/Project3/Downloads/Test1.xls"<BR><BR>set xlApp = Server.CreateObject("Excel.Application")<BR>set xlBook = xlApp.Workbooks.Add<BR>set xlSheet = xlBook.Worksheets(1)<BR><BR>xlapp.DisplayAlerts = True<BR>xlApp.Application.Visible = True<BR>xlApp.ActiveSheet.Cells(1,1).Value = "Test Output"<BR>xlSheet.SaveAs Server.MapPath(strFileName)<BR>xlApp.DisplayAlerts = True<BR>xlApp.Application.Quit<BR><BR>set xlSheet = nothing<BR>set xlBook = nothing<BR>set xlApp = nothing<BR>"<BR><BR>

  2. #2
    Sreedharan Surendran Guest

    Default RE: Problem Creting Excel .xls file from ASP

    Looking at your code it is hard to tell off-hand. But I would suggest that you create a DLL in VB for the purpose (I hope that you know VB). You will be able to do a better job, also debugging is much easier. Unless you have a restriction on creating objects?

  3. #3
    Join Date
    Dec 1969

    Default RE: Problem Creting Excel .xls file from ASP

    Try setting xlApp.DisplayAlerts = False instead of True.<BR>Also, why are you using xlApp.Visible = True? All that does is show Excel on the server. (which I&#039;m assuming the user isn&#039;t at.)<BR><BR>It seems like Excel is waiting for an answer to some question and thus the web server times out, or it might not have privileges to the directory you&#039;re trying to save the Excel files to.<BR><BR>Hope that helps a little.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts