Chart problem with Excel 2007

Hi guys, I’ve got a problem with an agent that has been running perfectly well for years…the following line of code now throws the error “Automation Object Member not found”

Set Piechartobj1 = WB.WorkSheets(3).ChartObjects.Add(CoordsX, CoordsY, ChartSize, ChartSize + CoordsX)

Previous version of office (2003) had no problems at all. Several hours hunting through the Internet and relevant documentation have proved fruitless.

Has anyone else experienced anything similar since upgrading to Office 2007?

Thanks in advance.

Dave

Subject: Chart problem with Excel 2007

Hi, did you find a solution or workaround to this issue? I am having the same problem.

Thanks

Subject: Chart problem with Excel 2007: solved

hi,it seems like Excel 2007 requires the WorkSheet.ChartObjects member to be called as a function.

Using

sheet.ChartObjects().Count

(Note the “()”) works on 2007 and 2003

martin

Subject: RE: Chart problem with Excel 2007: solved

Thank you so much for posting this solution! I had been struggling with the same problem, with code that had worked for years.

So, adding a chart now needs the () brackets as follows:

Set ChartObj = xlSheet.ChartObjects().Add.left, .top, .width, .height)

Thanks again!

Subject: Thanks - almost five years later!

My client skipped from Excel 2003 to 2010 so I just encountered this issue… Many thanks.