I wanna import my ListBox in a Excel File. But i keep getting this error HRESULT: 0x800A03EC can someone help me i googled it but couldnt find anything
My code
string ExcelFileLocation = (@"C:\Users\bra\Desktop\EXCELFILe");
Excel.Application oApp;
Excel.Worksheet oSheet;
Excel.Workbook oBook;
oApp = new Excel.Application();
oBook = oApp.Workbooks.Add();
oSheet = (Excel.Worksheet) oBook.Worksheets.get_Item(1);
int i = 0;
i++;
for (int j = 0; j < listBox1.Items.Count; j++)
{
oSheet.Cells[j, 1] = listBox1.Items;
}
oBook.SaveAs(ExcelFileLocation);
oBook.Close();
oApp.Quit();
my ListBox items
private void Form1_Load(object sender, EventArgs e)
{
listBox1.Items.Add("TEST1");
listBox1.Items.Add("TEST2");
listBox1.Items.Add("TEST3");
}