Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete series in Excel graph from Access
Message
General information
Forum:
Microsoft Office
Category:
Access
Miscellaneous
Thread ID:
00576337
Message ID:
00577639
Views:
21
This message has been marked as the solution to the initial question of the thread.
I was just looking at the docs, here is what it says about deleting points: "Deleting a Point or LegendKey object deletes the entire series"

So deleting one of them does not delete the series?

You might want to give the LegendKey a shot too.

>The data in those columns are present, but not needed. When I try to loop from 1 to Points.Count and delete them, it gives the error "Object required" on the second one. Looping from Points.Count to 1 Step -1 gives the same error on number two hundred and something. I suppose that when you delete one, it renumbers them, but Step -1 didn't solve it.
>
>If I could get Series(nIndex).Delete to work, I wonder if it would remove the series from the legend. That is necessary, of course.
>
>The object references to the Series seem fine.
>
>Part of the goal here is to make my existing code work without too much rewriting. Instead of deleting lines from my default graph, I could take those lines out of the default graph and add them when needed. Since they are usually needed, that would slow things down a bit.
>
>>Are the data series empty? If so then deleting the points() would have the same effect as deleting the series (if I remember this correctly). So the call would change to: .SeriesCollection("Task Budgeted Expenditure").Points(nIndex).Delete
>>
>>Also try deleting by referring to the index instead of by name.
>>
>>>The KB article says it pertains to pivot charts, which mine isn't. They didn't exist in Excel 97. It does look as if I am seeing the same bug. I have a feeling that Microsoft knows it, but doesn't have a workaround for regular graphs. A series object doesn't have an .Orientation property or a .Visible property. So I don't know how to apply their workaround. Any other thoughts?
>>>
>>>Thank you.
>>>
>>>>See if this MSKB helps: http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q210735
>>>>
>>>>>I am converting/enabling an Access 97 .mdb that has Excel automation code which opens an Excel file, inserts data, and modifies the graph. The code to delete unneeded lines or series is not working in Access 2002, though it did work in Access 97.
>>>>>
>>>>>With objGraphSheet.ChartObjects(1).Chart
>>>>>.SeriesCollection("Task Budgeted Expenditure").Delete
>>>>>
>>>>>I get the error "Delete method of Series Class Failed". If I replace that command with
>>>>>.SeriesCollection("Task Budgeted Expenditure").Select
>>>>>Selection.Delete
>>>>>
>>>>>...the error says "Select method of Series Class Failed".
>>>>>
>>>>>I figure that the object reference to the chart is fine because other commands that use it are running fine. I tried putting this code in a macro in the Excel file itself and running it there, in Excel 2002. The macro ran, and correctly deleted the series.
>>>>>
>>>>>I also tried putting this command before the line deletion command:
>>>>>
>>>>>msgbox("Name = " & .SeriesCollection("Task Budgeted Expenditure").Name
>>>>>
>>>>>It made a messagebox saying "Name = Task Budgeted Expenditure" as it should. So the reference to the series seems fine.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform