Results 1 to 3 of 3

Thread: [RESOLVED] CopyFromRecordset in Range

  1. #1

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Resolved [RESOLVED] CopyFromRecordset in Range

    Hi

    Reading data from Oracle in Recordset, I must to export records to first sheet
    where first row is header and others are data
    The sheet already exists, How can I to export recordset from the second row of sheet in front

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: CopyFromRecordset in Range

    CopyFromRecordset is a method of the Range object.

    The following example is from the Help file.

    Code:
    This example copies the field names from a Recordset object into the first row 
    of a worksheet and formats the names as bold. The example then copies 
    the recordset onto the worksheet, beginning at cell A2. 
    
    For iCols = 0 to rs.Fields.Count - 1
        ws.Cells(1, iCols + 1).Value = rs.Fields(iCols).Name
    Next
    ws.Range(ws.Cells(1, 1),  _
    ws.Cells(1, rs.Fields.Count)).Font.Bold = True
    
    ws.Range("A2").CopyFromRecordset rs

  3. #3

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Thumbs up Re: CopyFromRecordset in Range

    Thank you very much

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