Export database records to EXCEL

Results 1 to 2 of 2

Thread: Export database records to EXCEL

  1. #1
    Ginola Guest

    Default Export database records to EXCEL

    I&#039;d like to dump the recordset from Access database to EXCEL so that users can get records on spreadsheet instead of HTML table. <BR><BR>I&#039;ve looked an article from 4guysfromrolla and tried. I got an error message. I went on to check with microsoft site to get help. No luck. It&#039;ll be great if anyone from this forum can give me a direction. <BR><BR>&#060;%@Language=VBScript%&#062;<BR>&#060; %Option Explicit%&#062;<BR>&#060;!--#include file="adovbs.inc"--&#062;<BR>&#060;!--#include file="connection.asp"--&#062;<BR><BR>&#060;%<BR>Dim SQLprocess, objRSprocess, location, numbercols, numberrows, I, J, objSpreadsheet<BR>Set objSpreadsheet = Server.CreateObject("OWC.Spreadsheet") <BR>SQLprocess="SELECT * FROM aTable"<BR>Set objRSprocess=Server.CreateObject("ADODB.Recordset" )<BR>objRSprocess.Open SQLprocess,oConn,,adLockOptimistic,adCmdText<BR>lo cation=objRSprocess.getrows<BR>numbercols=ubound(l ocation,1)<BR>numberrows=ubound(location,2)<BR><BR ><BR>For I=0 to numberrows<BR> For J=0 to numbercols<BR> objSpreadsheet.Cells(I, J).Value = location(J,I) <BR> Next<BR>Next<BR><BR>objSpreadsheet.ActiveSheet.Exp ort("C:Inetpubwwwroot est hisisatest.xls", 0) <BR><BR>objRSprocess.close<BR>Set objRSprocess=nothing<BR>oConn.close<BR>Set oConn=nothing<BR>%&#062;<BR><BR>Microsoft VBScript compilation error &#039;800a0414&#039; <BR><BR>Cannot use parentheses when calling a Sub <BR><BR>/exceltest.asp, line 23 <BR><BR>objSpreadsheet.ActiveSheet.Export("C:Inetp ubwwwroot est hisisatest.xls", 0)<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Read the error

    Try<BR>objSpreadsheet.ActiveSheet.Export "C:Inetpubwwwroot est hisisatest.xls", 0<BR>and see what happens.<BR>HTH<BR>Dom

Posting Permissions

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