LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
JKP JKP is offline
external usenet poster
 
Posts: 2
Default ADO Recordset to Excel 2007 Worksheet Cell Values via XML

HiJames,

A bit late perhaps, but I found this thread only today.

Why would you want to push the recordset into Excel using XML? Do you
know you can use the CopyFromRecordset method to write a recordset to
Excel in one go?

Example (oADOConn is an object variable that holds the connection to
the database):

sSQL = "SELECT * FROM Table"
oRS.Open sSQL, oADOconn
For Each oFld In oRS.Fields
lCount = lCount + 1
oSh.Cells(1, lCount).Value = oFld.Name
Next
If Not oRS.EOF Then
oSh.Range("A2").CopyFromRecordset oRS
End If
oRS.Close
Set oRS = Nothing
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protecting a range or cell in a worksheet Excel 2007 life4paws Excel Programming 1 July 26th 09 06:25 AM
Excel 2007 - referencing a cell value from another worksheet withi crisg Excel Discussion (Misc queries) 7 February 9th 09 10:24 PM
Recordset from excel worksheet Damien McBain[_3_] Excel Programming 4 March 8th 07 08:35 AM
Repost! Excel multiple worksheet populate from recordset B[_3_] Excel Programming 1 November 6th 04 10:56 AM
Help! Excel multiple worksheet populate from recordset B[_3_] Excel Programming 1 November 5th 04 09:59 AM


All times are GMT +1. The time now is 02:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"