Solved

Problem upgrading VBA from MS Excel 2003 to 2010

Posted on 2014-10-29
7
230 Views
Last Modified: 2014-10-29
I have a problem upgrading code from MS Excel 2003 to MS Excel 2010. Below lines work fine in 2003, but don't work in 2010. Please help

worksheets("ABC").ChartObjects("Graph1").Activate
ActiveChart.DrawingObjects.Delete

The first line works, but when I want to delete all drawingobjects on the graph, it gives an error: 'Method delete of class DrawingObjects failed'. Do you have code to remove all objects inside the graph?
0
Comment
Question by:Frans_Truyens
  • 4
  • 2
7 Comments
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 40410422
Hi,

pls try

    For Each shp In ActiveChart.Shapes
            shp.Delete
    Next


Regards
0
 
LVL 2

Expert Comment

by:Glen Richmond
ID: 40410423
try direct obj ref

dim myObj as object

set myObj = worksheets("ABC").ChartObjects("Graph1")

myObj.Delete

Open in new window

0
 

Author Comment

by:Frans_Truyens
ID: 40410436
I don't want to delete the graph. Only the contents, the drawingobjects on it.
0
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40410463
Have you tried my code?

worksheets("ABC").ChartObjects("Graph1").Activate
For Each shp In ActiveChart.Shapes
    shp.Delete
Next
0
 

Author Comment

by:Frans_Truyens
ID: 40410507
Rgonzo1971
We are trying it now.
0
 

Author Comment

by:Frans_Truyens
ID: 40410525
It works! Thanks a lot.
0
 

Author Closing Comment

by:Frans_Truyens
ID: 40410527
Thanks a lot
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This article will shed light on the latest trends when it comes to your resume building needs. For far too long, the traditional CV format has monopolized the recruitment market.
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question