PC Review


Reply
Thread Tools Rate Thread

Delete chart without being prompted?

 
 
Herrick Andrews
Guest
Posts: n/a
 
      30th Apr 2008
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


 
Reply With Quote
 
 
 
 
Mark Ivey
Guest
Posts: n/a
 
      30th Apr 2008
See if this will work...

Mark Ivey


Sub AddDeleteChartTest()
Dim c As Excel.Chart

Set c = Excel.Charts.Add

Application.DisplayAlerts = False

c.Delete

Application.DisplayAlerts = True

End Sub










"Herrick Andrews" <Herrick.Andrews@AT> wrote in message
news:#(E-Mail Removed)...
> 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
>

 
Reply With Quote
 
Herrick Andrews
Guest
Posts: n/a
 
      30th Apr 2008
Did the trick!! Thanks!!


"Mark Ivey" <(E-Mail Removed)_(do_not_spam)> wrote in message
news:B3B8820A-E621-4E8B-BEA2-(E-Mail Removed)...
> See if this will work...
>
> Mark Ivey
>
>
> Sub AddDeleteChartTest()
> Dim c As Excel.Chart
>
> Set c = Excel.Charts.Add
>
> Application.DisplayAlerts = False
>
> c.Delete
>
> Application.DisplayAlerts = True
>
> End Sub
>
>
>
>
>
>
>
>
>
>
> "Herrick Andrews" <Herrick.Andrews@AT> wrote in message
> news:#(E-Mail Removed)...
>> 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
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete multiple calendar entries without being prompted to send cancellations lurchajn Microsoft Outlook 0 8th Aug 2007 04:04 PM
how do you delete a contact from being prompted? =?Utf-8?B?UmVkcmVlZnJlYWx0eS5jb20=?= Microsoft Outlook Contacts 3 3rd Jun 2006 10:24 PM
Am prompted to confirm a delete action Sando 72 Microsoft Word New Users 1 28th Sep 2004 07:20 AM
RE: Getting prompted to delete text =?Utf-8?B?U3VzYW4gVy4gR2FsbGFnaGVy?= Microsoft Word Document Management 1 29th Apr 2004 01:11 AM
Password prompted during profile delete Brent Microsoft Outlook 2 10th Dec 2003 04:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:01 PM.