I've previously resolved floating EXCEL.EXE files by releasing the worksheet,workbook,and application objects from EXCEL. However, I've noticed that after referencing cell ranges that this .EXE file comes back.
I've commented out the section where i reference these cells and that is in fact what is going on. I've tried releasing the cell itself and the cell's range but that is not working.
I know this may be a repeated question but it's something I'm really having trouble with understanding.
Dim app As New Microsoft.Office.Interop.Excel.Application
Dim book As Microsoft.Office.Interop.Excel.Workbook = app.Workbooks.Open(file)
Dim worksheet As Microsoft.Office.Interop.Excel.Worksheet = book.Worksheets("Sheet1")
app.Visible = True
While (worksheet.Cells.Range("A" & max_row).Value IsNot Nothing)
max_row = max_row + 1
End While
If max_row > 2 Or max_row = 2 Then
For i As Integer = 2 To max_row Step 1
MessageBox.Show("here")
Dim add As DataRow = Me.CentralDatabaseDataSet.Selected_Equipment.NewRow
If "Section " & worksheet.Cells.Range("J" & i).Text = cboSection.SelectedItem.ToString Then
add("Type") = worksheet.Cells.Range("A" & i).Text
ReleaseObject(worksheet.Cells(i, 1))
'add("Description") = worksheet.Cells.Range("B" & i).Text
'add("Model Number") = worksheet.Cells.Range("C" & i).Text
'add("Serial Number") = worksheet.Cells.Range("D" & i).Text
'add("Asset Number") = worksheet.Cells.Range("E" & i).Text
'add("Manufacturer ID") = worksheet.Cells.Range("F" & i).Text
'add("Department ID") = worksheet.Cells.Range("G" & i).Text
'add("Last Calibration") = worksheet.Cells.Range("H" & i).Text
'add("Calibration Due Date") = worksheet.Cells.Range("I" & i).Text
'Me.CentralDatabaseDataSet.Selected_Equipment.AddSelected_EquipmentRow(add)
End If
Next
End If
book.Close()
app.Quit()
ReleaseObject(worksheet)
ReleaseObject(book)
ReleaseObject(app)