I tried this code:
Charts charts = a_wb.GetCharts();
while (charts.GetCount() > 0) {
_Chart chrt = charts.GetItem((COleVariant)((short)1));
chrt.Delete();
}
and many more algorithms...
Nothing works for me!!!
Can someone help please???
Thanks.
Public Sub delcharts()
Dim ws As Worksheet
Dim cht As Object
If ThisWorkbook.Charts.Count > 0 Then
'The next line deletes all chart sheets
ThisWorkbook.Charts.Delete
End If
'The code below removes all embedded charts
For Each ws In ThisWorkbook.Sheets
For Each cht In ws.ChartObjects
cht.Delete
Next
Next
End Sub
--
Alan Moseley IT Consultancy
http://www.amitc.co.uk
If I have solved your problem, please click Yes below. Thanks.
Cheers!