Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default how to delete all msoFreeForms on a chart

Hello Group,

I have a chart sheet that contains a bunch of msoFreeForm objects, and I want to delete all of them hopefully with one statement.

If I select one and check its Typename I get "Rectangle". But Activechart.Rectangles.Delete does not delete them.

How can I delete them?

Thanks,

Brian Murphy
Austin, Texas

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default how to delete all msoFreeForms on a chart

Hi Brian,

Brian Murphy wrote:
I have a chart sheet that contains a bunch of msoFreeForm objects, and I want to delete all of them hopefully with one statement.

If I select one and check its Typename I get "Rectangle". But Activechart.Rectangles.Delete does not delete them.

How can I delete them?


try this:
Dim sh As Shape

For Each sh In ActiveSheet.Shapes
If sh.Type = msoFreeform Then sh.Delete
Next sh

or delete all DrawingObjects:

ActiveSheet.DrawingObjects.Delete

--
Regards
Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default how to delete all msoFreeForms on a chart

Thank you, Melanie.

I will give that a try. I probably can't do
ActiveSheet.DrawingObjects.Delete because of some TextBoxes on the chart.

I suppose the loop will work. Too bad there doesn't appear to be a single
command to delete all of the same type of Shape.

activechart.shapes.SelectAll also selects my textboxes, so no good.

Brian


"Melanie Breden" wrote in message
...
Hi Brian,

Brian Murphy wrote:
I have a chart sheet that contains a bunch of msoFreeForm objects, and I

want to delete all of them hopefully with one statement.

If I select one and check its Typename I get "Rectangle". But

Activechart.Rectangles.Delete does not delete them.

How can I delete them?


try this:
Dim sh As Shape

For Each sh In ActiveSheet.Shapes
If sh.Type = msoFreeform Then sh.Delete
Next sh

or delete all DrawingObjects:

ActiveSheet.DrawingObjects.Delete

--
Regards
Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to delete chart NonTechie Charts and Charting in Excel 7 September 24th 09 05:59 AM
Delete embedded chart, how? Boswell Charts and Charting in Excel 1 December 16th 07 07:08 PM
delete chart Wayne Excel Discussion (Misc queries) 6 May 3rd 07 03:00 PM
Delete Chart agac8103 Charts and Charting in Excel 3 December 13th 04 04:54 AM
Using VBA to Delete a Chart MikeM[_2_] Excel Programming 3 October 14th 03 02:49 AM


All times are GMT +1. The time now is 10:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"