|I need to be able to send text to a selected worksheet that is already opened.
This, I think is close but it didn't work:
string wb = cmb_BookName.Text.ToString();
string ws = cmb_SheetName.Text.ToString();
Excel.Application oexcel = new Excel.Application();
Excel.Workbook wkbk = (Excel.Workbook)oexcel.Workbooks[wb];
Excel.Worksheet wksk = (Excel.Worksheet)wkbk.Sheets[ws];
Range cellRange = wksk.Range["D48:D48"];
cellRange.Value = cboContainer.Text;
The code builds without errors but when running it stops at the line trying to get the workbook and gives me an Exception Unhandled message.
So basically my question still is how do I work with an excel workbook that is already opened?
Seems like most of the articles that I find are opening an excel file and then working with it. In my case, I need to work with an already opened excel workbook.