Adding Excel charts to PowerPoint presentation in Office 2003

T

trooper665

In Office 2000 this code worked perfectly:

Dim xlCurrChart As Excel.Chart
Dim xlBook As Excel.Workbook
Dim pptShape As PowerPoint.Shape

Set pptShape = rpptTarget.Shapes.AddOLEObject(Width:=fDefaultWidth,
Height:=fDefaultHeight, ClassName:="Excel.Sheet")

Set xlBook = pptShape.OLEFormat.Object
Set xlCurrChart = xlBook.Charts.Add()

But now testing this with Office 2003, the last line raises an error. The
weird thing is that this code is in a loop and the error is only raised the
first time that this code fires. After the first loop, the code no longer
raises any errors and works fine.

The error message is:
Error number: - 2147417851 method '~' of object '~' failed.

Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top