Results 1 to 5 of 5

Thread: Excel file/ Visual Basic programming

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    10

    Question

    If I saved an Excel file in a similar grid format (columns & rows)- what programming code would I use to pull only the information I need based on the user inputting a specific column and row?

    Any reply would be appreciated!
    Thanks,
    Stephen
    [email protected]


    [Edited by lspeed430 on 07-26-2000 at 06:11 PM]

  2. #2
    New Member
    Join Date
    May 2000
    Posts
    8
    Is your app acually looking at the excel file? If so you can use the data object or one of the other methods. I use DAO:

    Dim data1 As Database
    Dim rs As Recordset
    Set data1 = OpenDatabase("c:\my documents\sample.xls", False, True, "excel 8.0;")
    Set rs = data1.OpenRecordset(sheet1) 'picks a table from sample.xls called sheet1

    Dim col, row, as integer
    'get them from user

    for j = 1 to row
    rs.movenext
    next row 'gets you to the row

    textout= rs.fields(col)' assuming the top row of your excel is numbered 1 2 3 etc.

    Humph

  3. #3
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    To retrieve data from a specific loaction, do

    variable = myExcelWrk.Cells(r,c).Value

    where myExcelWrk is an instance of an Excel worksheet,
    r represents the row and,
    c represents the column

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    10
    Thanks J Hausman & Humph for your replies...
    I really do appreciate this...
    you guys are helping me get a programmer's job!!!!

    I guess the same hints that you both gave me can go for a .csv file saved from an Excel database.

  5. #5
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    My approach reads Excel directly...

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