Solved

Problem upgrading VBA from MS Excel 2003 to 2010

Posted on 2014-10-29
7
231 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 50

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
Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

 
LVL 50

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

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
outlook 2016 orgnize ideas 2 92
Excel sheet question 12 51
MS Excel: Conditional formatting with a time delay 7 67
VIDEO DATASOURCE Control Resize issue 2 31
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
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…

808 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