Results 1 to 4 of 4

Thread: [RESOLVED] Reading Cells in Excel Using VB.NET

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2004
    Location
    Milwaukee, Wisconsin, USA
    Posts
    133

    Question [RESOLVED] Reading Cells in Excel Using VB.NET

    Back in VB6, all I had to do is create the Excel.Application object, open the workbook and use the cells object. That doesn't seem to work using vb.net.

    In vb.net, I'm imported the following namespace:
    Code:
    Imports Excel = Microsoft.Office.Interop.Excel
    Then, I create the object
    Code:
    Dim oApp As Excel.Application = New Excel.Application
    Then, using a with oApp block, I am able to open the workbook
    Code:
    .Workbooks.Open(strSource, , , , , "dbbfrb")
    Then, I try to read a cell value (This is where the exception is thown)
    Code:
    If CStr(.Cells(X, 1)) = "098" Then
    Does anybody know how to read from or write to cells in Excel using vb.net? Obviously, I'm missing a step but I can't seem to find what it is.

    Any help on this would be greatly appreciated...
    Last edited by robbie; May 11th, 2007 at 10:54 AM.

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