Results 1 to 3 of 3

Thread: Excel Reference

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026

    Excel Reference

    In my latest project I have the need to import data from an Excel workbook.

    The thing is, I have Office 2003 loaded on my computer and I'm not sure what version will be loaded on my client's computers when they are running my software.

    When I was looking at the Excel references, I noticed that there was one in there for 5.0 as well as 11.0.... Is the Excel 5.0 (library i guess) a standard one that is shipped with all versions of Office, or is this just a fluke?

    Thanks,

    Squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

  2. #2
    Hyperactive Member CyberHawke's Avatar
    Join Date
    May 2004
    Location
    Washington DC
    Posts
    477
    Have you considered opening the workbook using ADO?

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026
    This is what I am using...

    VB Code:
    1. Dim DS As System.Data.DataSet
    2.         Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
    3.         Dim MyConnection As System.Data.OleDb.OleDbConnection
    4.  
    5.         MyConnection = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; data source=" & ofdOpen.FileName & "; Extended Properties=Excel 8.0;")
    6.         ' Select the data from Sheet1 of the workbook.
    7.         MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", MyConnection)
    8.  
    9.         DS = New System.Data.DataSet
    10.         MyCommand.Fill(DS)
    11.         MyConnection.Close()
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

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