I'm opening an excel worksheet using the Microsoft.Office.Interop.Excel COM interface. I'm trying to adjust the "maximum" value of a scroll bar embedded into a worksheet. I can find the scroll bar with the following:
app = new Excel.Application();
wb = app.Workbooks.Open(
Path.GetDirectoryName(Application.ExecutablePath)+@"\template.xls",
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
for (int sheetNum = 1; sheetNum < wb.Sheets.Count + 1; sheetNum++)
{
ws = (Excel.Worksheet)wb.Sheets[sheetNum];
if (ws.Name == "Graphic")
{
foreach (Excel.Shape ctrl in ws.Shapes)
{
if (ctrl.Name == "graphicScroll")
{
// how do a cast this??
break;
}
}
}
break;
}
Once I get the shape object though, I can not figure out the proper cast so that I can adjust it's properties.
Any ideas?
Thanks.