Giờ e muốn kiểm tra giá trị của 1 cell trong file excel. Nếu giá trị cell đó không thỏa mãn điều kiện của mình thì move file đó sang thư mục khác. Nhưng khi chạy thì nó cứ báo "The process cannot access the file because it is being used by another process" mặc dù e đã close, quit các kiểu rồi mà vẫn bị. Code của e đây ak. Mong các pro giúp đỡ
Dim xlApp As Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet xlApp = New Excel.ApplicationClass
xlWorkBook = xlApp.Workbooks.Open("C:\test.xls") xlWorkSheet = xlWorkBook.Worksheets(1)
Dim sheetname As String = xlWorkSheet.Name
If Replace(xlWorkSheet.Range("A7").Value, " ", "") <> "STT" Then
xlWorkBook.Save()
xlWorkBook.Close()
xlApp.Quit()
releaseObject(xlApp)
releaseObject(xlWorkBook)
releaseObject(xlWorkSheet)
My.Computer.FileSystem.MoveFile("C:\test.xls", "D:\FILE_ERROR\test.xls", overwrite:=True) 'Move file den thu muc FILE_ERROR GoTo Next_item
End If