Reputation:
hi let's say i have images on my excel worksheet, how is it possible to delete/remove them from the sheet using c#,
following code gives me exception
Excel.Worksheet ws = Globals.ThisAddIn.GetActiveWorksheet();
foreach (Excel.Shape sh in ws.Shapes)
{
sh.Delete();
}
thanks!
Upvotes: 3
Views: 2761
Reputation:
never mind, i forgot that my sheet was protected,
Excel.Worksheet ws = Globals.ThisAddIn.GetActiveWorksheet();
ws.Unprotect("PASSWORD");
foreach (Excel.Shape sh in ws.Shapes)
{
sh.Delete();
}
it works fine!
Upvotes: 2