Imported charts disappear

  • Thread starter Thread starter sylvainpellletier
  • Start date Start date
S

sylvainpellletier

Hi everybody,

I run a macro from Excel that :
creates charts and save each as a new xls file
open PPT and creates a new presentation
import each chart

Here is a part of my code :

Dim Graph As Object
Dim grp As Graph.Application

PPApp.ActiveWindow.Selection.SlideRange.Shapes.Item(4).Select
PPApp.ActiveWindow.Selection.ShapeRange.OLEFormat.DoVerb Index:=2
With PPApp.ActiveWindow.Selection.ShapeRange.OLEFormat
Set grp = .Object.Application
End With

grp.FileImport "C:\Documents and Settings\Graph1.xls"

PPApp.ActiveWindow.Selection.Unselect

grp.Quit

The charts look OK in PPT. But when I double click on them if I want to
edit them, they turn back to the ppt default chart and I lost all the
data that I have imported.

How can I fix this ?

Thanks for your help.

Bye
 
Thanks for posting your code along with your question. Very helpful.

You need to use the Graph application's .Update method before .Quit
See below:

Hi everybody,

I run a macro from Excel that :
creates charts and save each as a new xls file
open PPT and creates a new presentation
import each chart

Here is a part of my code :

Dim Graph As Object
Dim grp As Graph.Application

PPApp.ActiveWindow.Selection.SlideRange.Shapes.Item(4).Select
PPApp.ActiveWindow.Selection.ShapeRange.OLEFormat.DoVerb Index:=2
With PPApp.ActiveWindow.Selection.ShapeRange.OLEFormat
Set grp = .Object.Application
End With

grp.FileImport "C:\Documents and Settings\Graph1.xls"

PPApp.ActiveWindow.Selection.Unselect

Add this here:

grp.Update
 
Back
Top