View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Herrick Andrews Herrick Andrews is offline
external usenet poster
 
Posts: 1
Default Delete chart without being prompted?

Is there a way to delete a chart object via VBA code without it prompting me
if I really want to delete it? If I change the location of the chart so
it's embedded in a worksheet, and then delete it, I don't get prompted. But
I can't do that. I need to delete the chart while it's its own chart sheet
(not embedded in a worksheet). I created the chart programmatically.

The following two lines of code cause the problem every time for me.

Sub AddDeleteChartTest()
Dim c As Excel.Chart

Set c = Excel.Charts.Add

c.Delete ' I get a DialogBox saying "Data may exist in the sheet(s)
selected for deletion. To permanently delete the data, press Delete."
End Sub