.NET 4.5 ile VB.NET'te bir formum var. Formun yan yana açılan bir EXCEL dosyası var.VB.NET Formundan Excel sayfasındaki canlı güncelleştirme verileri Form
Güncel verileri EXCEL sayfasında LIVE kodundan görmek istiyorum. Ancak verileri göremiyorum. Aşağıda
kodImports 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