• 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.
  • Posts

  • Recent Achievements

    • One Month Later
      SekTheFirst earned a badge
      One Month Later
    • First Post
      zayanhani earned a badge
      First Post
    • First Post
      HarryTaylor earned a badge
      First Post
    • One Year In
      Eternal Tech earned a badge
      One Year In
    • One Month Later
      Eternal Tech earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      649
    2. 2
      ATLien_0
      225
    3. 3
      Michael Scrip
      224
    4. 4
      Steven P.
      141
    5. 5
      +FloatingFatMan
      141
  • Tell a friend

    Love Neowin? Tell a friend!