• 0

VB.NET reading cells in excel


Question

I'm trying to read an excel file that is updating programmically.  Below is my code, problem is that if the value of cell 1,1 is "123" then it will read "123" each time I "hit the button", however this cell will be constantly changing with numbers every second, and I want it that when it is changed I am able to pick u the new number.  I know the issue is that the new number "isn't saved"  anyone have any ideas on a work around?

 

Maybe like an OnEventChange handler for excel

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
     Handles Button1.Click

 

        workbook = APP.Workbooks.Open("C:\Users\Brian\Desktop\Matthew4.xlsx
        worksheet = workbook.Worksheets("sheet1")
        Dim s As String = worksheet.Cells(1, 1).Value
        workbook.Close()

 

    End Sub

Edited by newprogrammer123
Link to comment
https://www.neowin.net/forum/topic/1315424-vbnet-reading-cells-in-excel/
Share on other sites

1 answer to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.