The key to the speed is not looping through the recordset itself, but using
the getrows and an array. Just modify this for your needs.
MYARRAY = MYRST.GetRows
MYRST.Close
ExportString = ""
For X = 0 To UBound(MYARRAY , 2)
For I = 0 To UBound(MYARRAY , 1)
ExportString = ExportString & MYARRAY (I, X) & ","
Next
Print #2, ExportString
frmExport.Caption = "Exporting record number " & X + 1
ExportString = ""
DoEvents
Next
-----Original Message-----
From: Daniel Magliola [mailto:[EMAIL PROTECTED]
Sent: Monday, October 25, 2004 4:14 PM
To: [EMAIL PROTECTED]
Subject: RE: [vbhelp] Vb.Net - Export Dataset to Excel
Yes, I would
Thanks!
> -----Mensaje original-----
> De: Ben Rosato [mailto:[EMAIL PROTECTED]
> Enviado el: Monday, October 25, 2004 17:13
> Para: [EMAIL PROTECTED]
> Asunto: RE: [vbhelp] Vb.Net - Export Dataset to Excel
>
>
>
> I have written a function that will export a recordset to .csv
> It is pretty
> quick. I can dump out 2000 records with 254 columns in about 2 seconds.
> Let me know if you would like it.
>
> -----Original Message-----
> From: Daniel Magliola [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 25, 2004 3:51 PM
> To: [EMAIL PROTECTED]
> Subject: [vbhelp] Vb.Net - Export Dataset to Excel
>
>
>
> Dear Group,
>
> I currently have a Dataset that is filled with the results of a SELECT
> Stored Procedure.
> (I created a Command for the SP, a DataAdapter for that command, and used
> that DataAdapter to fill the Dataset)
>
> Now i need to export that Dataset to Excel.
> I want to do this as automatically as possible. I'd like to avoid the
> solution of recursing through all the rows in the Dataset, and manually
> writing the cells in Excel. (And this is the only solution I could come up
> with so far).
>
> If I were using Excel 2002, I could export the Dataset to an XML
> file (I've
> already done this), and I could import it into Excel, but I'm using Excel
> 2000.
> I've also read about using an XSLT to transform the XMl data into
> a CSV, or
> a tab-delimited file, but the problem is that the format of the XML will
> vary a little depending on what SP I call, and I want this to be generic.
>
> If any of you can think of something for this, I'd really really
> appreciate
> it.
>
> Thanks a lot.
>
> Daniel Magliola
> Cimatic SRL
> +5411 4787 5311
>
>
>
>
>
> '// =======================================================
> Rules : http://ReliableAnswers.com/List/Rules.asp
> Home : http://groups.yahoo.com/group/vbHelp/
> =======================================================
> Post : [EMAIL PROTECTED]
> Join : [EMAIL PROTECTED]
> Leave : [EMAIL PROTECTED]
> '// =======================================================
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.779 / Virus Database: 526 - Release Date: 10/19/2004
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.779 / Virus Database: 526 - Release Date: 10/19/2004
>
>
>
>
>
>
> '// =======================================================
> Rules : http://ReliableAnswers.com/List/Rules.asp
> Home : http://groups.yahoo.com/group/vbHelp/
> =======================================================
> Post : [EMAIL PROTECTED]
> Join : [EMAIL PROTECTED]
> Leave : [EMAIL PROTECTED]
> '// =======================================================
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
'// =======================================================
Rules : http://ReliableAnswers.com/List/Rules.asp
Home : http://groups.yahoo.com/group/vbHelp/
=======================================================
Post : [EMAIL PROTECTED]
Join : [EMAIL PROTECTED]
Leave : [EMAIL PROTECTED]
'// =======================================================
Yahoo! Groups Links
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.779 / Virus Database: 526 - Release Date: 10/19/2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.779 / Virus Database: 526 - Release Date: 10/19/2004
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/k7folB/TM
--------------------------------------------------------------------~->
'// =======================================================
Rules : http://ReliableAnswers.com/List/Rules.asp
Home : http://groups.yahoo.com/group/vbHelp/
=======================================================
Post : [EMAIL PROTECTED]
Join : [EMAIL PROTECTED]
Leave : [EMAIL PROTECTED]
'// =======================================================
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/vbhelp/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/