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()
Bad News: Although it has been about 10 years ago, I have purchased a "Sold and Shipped by Amazon" SanDisk USB drive that was counterfeit. They exchanged it no problem.
Use the utility Jim K referenced above and you will know for sure if something is not legit.
Question
newprogrammer123
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 newprogrammer123Link 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