I am using Interop to read and write to excel but I'm having some problems writing to excel... When I enter the information I need to be written on the excel in an inputbox, this pops up "COM object that has been separated from its underlying RCW cannot be used."
Heres the Code:
product is a string from a textbox, thats another problem but this error appears on the xlApp.workbook.open. Any ideas?Code:Private Sub editmodelbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles editmodelbtn.Click Dim message, title, defaultValue As String message = Enter New Model" title = "Editar Modelo" defaultValue = "" edit = InputBox(message, title, defaultValue) If edit = "" Then MsgBox("No change Made", MsgBoxStyle.Exclamation) Else xlWorkBook = xlApp.Workbooks.Open("C:\Users\DF\Desktop\testing.xls") xlWorkSheet = xlWorkBook.Sheets("Sheet1") xlApp.Visible = False xlWorkSheet.Cells(product, 3) = editar xlWorkBook.Save() xlWorkBook.Close() releaseObject(xlApp) releaseObject(xlWorkBook) releaseObject(xlWorkSheet) End If End Sub![]()




Reply With Quote
