Results 1 to 3 of 3

Thread: VB5.0 and Excell----URGENT PLEASE

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    Blackpool
    Posts
    14

    Post

    Does anybody out there know how I can import the contents of an ADO recordset into an excell worksheet. There is a CopyFromRecordset method but it only supports DAO recordsets (Excel 97 dont know about 2000). I will step through the recordset and insert each row individually but I cannot even find out how to insert a string into a cell????

  2. #2
    New Member
    Join Date
    Jan 2000
    Location
    Platteville, WI, USA
    Posts
    4

    Post

    to put a string in a cell use

    Sheet1.cells(row, col) = "my text"

  3. #3
    Member
    Join Date
    Jan 1999
    Location
    Vancouver, BC, Canada
    Posts
    32

    Post

    Look up the 'GetRows' method in the ADO documentation. It allows you to assign the contents of an entire recordset to something else (like an array, etc.)

    I haven't tried this with Excel, but it should go something like this:

    Worksheets("Sheet1").Range("A1") = RS.GetRows(X)

    Where X is the number of rows you want to retrieve from your recordset. This would assign the contents of your recordset to the Range beginning at cell A1.

Posting Permissions

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



Click Here to Expand Forum to Full Width