so I have asked how to change the value in a cell inside of excel using c#, but what if I want to change the value of a drop down list. The code I am using for sheet modifying i
Figured it out took me a long time please use it!!
using Excel = Microsoft.Office.Interop.Excel;
public virtual Object ActiveSheet { get; set; }
private void button15_Click(object sender, EventArgs e)
{
//Gets ActiveSheet to Modify
Excel.Application oXL;
Excel.Workbook oWB;
Excel.Worksheet oSheet;
//Start Excel and get Application object.
oXL = (Excel.Application)Marshal.GetActiveObject("Excel.Application");
oXL.Visible = true;
oWB = (Excel.Workbook)oXL.ActiveWorkbook;
oSheet = (Excel.Worksheet)oWB.ActiveSheet;
//Generate Linear Guide Supports using Design Table in Solidworks
if (comboBox1.Text == "0")//no external rails
{
oSheet.Cells[6, 4] = "0"; //Change Value in Cell in Excel Cell Location [y-axis, x-axis]
}
//Quit Excel
oXL.Quit();
}