Information générale
Titre:
Delete series in Excel graph from Access
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.
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement