У меня есть форма в VB.NET с .NET 4.5. У меня есть файл EXCEL, открытый бок о бок формы.Данные Live update в листе Excel из формы VB.NET
Я хочу видеть обновленные данные из кода LIVE в листе EXCEL. Но не могу видеть данные.
Ниже приведен код
Imports Microsoft.Office.Interop.Excel
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Me.OpenFileDialog1.ShowDialog()
Dim xlApp As Application
Dim xlWorkBook As Workbook
Dim xlWorkSheet As Worksheet
xlApp = New ApplicationClass
'xlApp.ScreenUpdating = False
xlWorkBook = xlApp.Workbooks.Open("E:\BACKUP\TRY.xls")
xlWorkSheet = xlWorkBook.Worksheets("Sheet1")
'display the cells value B2
MsgBox(xlWorkSheet.Cells(8, 1).value) 'GETTING EXISTING VALUE OK
'edit the cell with new value
xlWorkSheet.Cells(2, 2) = "HI" 'WANT TO SEE THIS DATA BEING LIVE UPDATED
'xlWorkBook.Close() 'DONT WANT TO CLOSE THE OPENED SHEET/WORKBOOK
'xlApp.ScreenUpdating = True
xlApp.Quit()
releaseObject(xlApp)
releaseObject(xlWorkBook)
releaseObject(xlWorkSheet)
End Sub
Private Sub releaseObject(ByVal obj As Object)
Try
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
obj = Nothing
Catch ex As Exception
obj = Nothing
Finally
GC.Collect()
End Try
End Sub
End Class