MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Need Help with Charts

  Asked By: Charlie    Date: Mar 05    Category: MS Office    Views: 898

I have an
Excel Report that is launched programmatically and runs with no user
interface. My specific question is with regards to three spreadhseets
that contain trend data with associated line charts.

Each time the report executes I delete the trend data from each of the
sheets and then go get the new trend data. What I would like to do is
check to see if a line chart exists and if so, delete it. I have the
code that creates the charts, but I haven't figured out how to delete
existing ones so I don't end up with charts piled up on top of charts
every time this report runs.



3 Answers Found

Answer #1    Answered By: Angelica Ramos     Answered On: Mar 05

you can use the chart  collection to count the charts  then loop through them
to delete  the charts

air code here

icount = workbooks.charts.count

for x = 1 to icount


next x

This is air code but is should be close enough to give you what you need...

Answer #2    Answered By: Lonnie Rogers     Answered On: Mar 05

Thanks - I'll fiddle with that a bit.

Answer #3    Answered By: Hubba Akhtar     Answered On: Mar 05

I too am fairly new but I was wondering if this approach would work?

If your trend data  is comming from a database then you could setup a query
definition that gets the new trend data when the query is refreshed. Each
charted view of the data is also automaticlly refreshed when the query updates.

Didn't find what you were looking for? Find more on Need Help with Charts Or get search suggestion and latest updates.