Write to Excel

Results 1 to 7 of 7

Thread: Write to Excel

  1. #1
    Lynn Maharet Guest

    Default Write to Excel

    Hi all,<BR><BR>Well I have this form that displays a table with all<BR>the records. When this report is generated, at the same time <BR>I want to save the table to an Excel spreadsheet BUT I do not<BR>want to open the Excel application. Pls adv. me. Thanks.

  2. #2
    BalletChick Guest

    Default RE: Write to Excel

    Am I the only person who knows how to use a search engine? :)<BR><BR><BR>Try these:<BR><BR>http://www.15seconds.com/issue/970515.htm<BR><BR>http://www.15seconds.com/issue/pv991021.htm<BR><BR><BR>

  3. #3
    Lynn Maharet Guest

    Default RE: Write to Excel(BalletChick)

    For ur info I hate search engines sometimes..<BR>Anyway thanks...;p

  4. #4
    BalletChick Guest

    Default RE: Write to Excel(BalletChick)

    I hate lima beans.

  5. #5
    Lynn Maharet Guest

    Default RE: Write to Excel(BalletChick)

    What the heck is lima beans?!

  6. #6
    BalletChick Guest

    Default RE: Write to Excel(BalletChick)

    Look them up in a search engine. :)

  7. #7
    Join Date
    Dec 1969

    Default RE: Write to Excel

    &nbsp;<BR><BR>You need to create a link to a page similar to the one below(the code is fairly generic). This page will create a CSV file on the server. It then redirects the user to this file and they are given the option to either open the file or save it to disk. They can then save it and open it in Excel later.<BR><BR>Ross<BR><BR><BR><BR>&#060;%@ LANGUAGE = VBScript %&#062;<BR>&#060;% response.buffer = true %&#062;<BR>&#060;!--#include virtual="/include/dbconn.asp" --&#062;<BR><BR>&#060;!--#include virtual="/session_mgmt.asp" --&#062;<BR>&#060;%<BR>&#039 get the stores<BR>query=request.form("sql")<BR><BR>Set rs = objConnB2BDATA.Execute(query, adCmdStoredProc) <BR><BR><BR><BR>set FileSystemObj = Server.CreateObject("Scripting.FileSystemObject")< BR>theTime = Time<BR>theTime = Replace(theTime,":","")<BR>WhereToCreateCSV="e:2b _websitedownloadsdownload" + CStr(Session("b2bUserid"))+ CStr(theTime) +".csv" <BR><BR><BR>set CSVFile = FileSystemObj.OpenTextFile(WhereToCreateCSV,2,TRUE ,0)<BR>TempLine = ""<BR>For Each Field in rs.Fields<BR>TempLine = TempLine & Replace(Field.Name,",","") & ","<BR>Next<BR>TempLine = Left(TempLine,Len(TempLine)-1)<BR>CSVFile.WriteLine TempLine<BR>TempDB = rs.GetRows<BR><BR>TempLine = ""<BR>For x = 0 to Ubound(TempDB,2)<BR>For y = 0 to Ubound(TempDB,1)<BR>If InStr(TempDB(y,x),",") &#062; 0 Then<BR> TempLine = TempLine & Replace(TempDB(y,x),",","") & ","<BR>Else<BR> TempLine = TempLine & TempDB(y,x) & ","<BR>End If<BR>Next<BR>TempLine = Left(TempLine,Len(TempLine)-1)<BR>CSVFile.WriteLine TempLine<BR>TempLine = ""<BR>Next<BR>CSVFile.Close<BR><BR>&#039WhereToRed irect="2b_websitedownloadsdownload" + CStr(Session("b2bUserid"))+ CStr(theTime) +".csv" <BR><BR>Response.Redirect("downloadsdownload" + CStr(Session("b2bUserid"))+ CStr(theTime) +".csv")<BR>%&#062;

Posting Permissions

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