Thu Nov 14, 2019 6:39 am
I tried to write into veriler sheet by below code then, tried to read the written values. while reading the values from the sheet, the error pops up,
Range row1 = worksheet.Rows.Cells[5, 2];
Range row2 = worksheet.Rows.Cells[6, 2];
Range row3 = worksheet.Rows.Cells[7, 2];
Range row4 = worksheet.Rows.Cells[8, 2];
Range row5 = worksheet.Rows.Cells[5, 3];
Range row6 = worksheet.Rows.Cells[6, 3];
Range row7 = worksheet.Rows.Cells[7, 3];
Range row8 = worksheet.Rows.Cells[8, 3];
Range row9 = worksheet.Rows.Cells[14, 2];
Range row10 = worksheet.Rows.Cells[15, 2];
Range row11 = worksheet.Rows.Cells[16, 2];
Range row12 = worksheet.Rows.Cells[14, 3];
Range row13 = worksheet.Rows.Cells[15, 3];
Range row14 = worksheet.Rows.Cells[16, 3];
Range row15 = worksheet.Rows.Cells[21, 2];
Range row16 = worksheet.Rows.Cells[25, 2];
Range row17 = worksheet.Rows.Cells[28, 2];
Range row18 = worksheet.Rows.Cells[32, 2];
Range row19 = worksheet.Rows.Cells[33, 2];
Range row20 = worksheet.Rows.Cells[34, 2];
row1.Value = txt1.Text;
row2.Value = txt2.Text;
row3.Value = txt3.Text;
row4.Value = txt4.Text;
row5.Value = txt5.Text;
row6.Value = txt6.Text;
row7.Value = txt7.Text;
row8.Value = txt8.Text;
row9.Value = txt9.Text;
row10.Value = txt10.Text;
row11.Value = txt11.Text;
row12.Value = txt12.Text;
row13.Value = txt13.Text;
row14.Value = txt14.Text;
row15.Value = txt15.Text;
row16.Value = txt16.Text;
row17.Value = txt17.Text;
row18.Value = txt18.Text;
row19.Value = txt19.Text;
row20.Value = txt20.Text;
excel.Application.ActiveWorkbook.Save();
excel.Application.Quit();
excel.Quit();
Marshal.FinalReleaseComObject(workbook);
Marshal.FinalReleaseComObject(worksheet);
Marshal.FinalReleaseComObject(excel);
- Attachments
-
- t2.rar
- (26.51 KiB) Downloaded 216 times