Results 1 to 2 of 2

Thread: Import Results from Excel File [VB6]

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2003
    Posts
    308

    Question Import Results from Excel File [VB6]

    Given the following:
    - A form [frmMain] with 3 textboxes [txt1, txt2, and txt3]
    - An Excel File (text.xls) with 2 rows and 3 columns that looks like the following
    NAME ID TYPE
    Jon 01 Active

    I need a way to import the results from the Excel file into the Textboxes.
    Row[0] is only headers (Name, ID, and Type) so Row[1] holds the actual data I need to retrieve.

    Currently I have the following written up (load the excel file and open it):

    Dim oExcel As Object
    Dim oBook As Object
    Dim oSheet As Object

    Set oExcel = CreateObject("Excel.Application")
    Set oBook = oExcel.Workbooks.Open(c:\test.xls, true)

    With oBook.Sheets(1)
    .Activate
    … now what? ….

    Any clues?
    I need a way to take those results from the Sheet and place them in the appropriate text boxes.

    Of course this is very generalized, in reality there are many rows and much more columns however this will serve as a great starting point for me.

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2003
    Posts
    308
    Is there a simple way to save a Range as a Recordset?
    Something similar to the .CopyFromRecordset command?
    Does there exist a .CopyToRecordset command?

    Because going cell by cell for a lot of Rows/Columns is not very efficient.

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