PasteSpecial Excel Chart in Powerpoint

G

Guest

I want to use PasteSpecial to embed an Excel chart in a Powerpoint slide. I
have been able to select the chart and copy it using CopyPicture, and I have
been able to use the shape.paste method using the PowerPoint slide object.
However when I try to use the Shape.PasteSpecial method with the PowerPoint
slide object, I get a variety of error messages.

Anyone have an example of this?

Dale
 
E

Ernst Schuurman

I use this code to copy charts into powerpoint presentation.

Set Dwbl = ThisWorkbook.Worksheets("sheetname")
Set Ch = ThisWorkbook.Charts(1)
Ch.Activate
Ch.ChartTitle.Font.Background = xlTransparent
Set ppt = New PowerPoint.Application
ppt.Visible = True
ppt.Presentations.Open "name.ppt"
Set Pres = ppt.ActivePresentation
Ch.Activate
Set Sl = Pres.Slides(n)
Sl.Shapes.Title.TextFrame.TextRange.Text = Ch.ChartTitle.Text
Sl.Shapes.Title.TextFrame.TextRange.Paragraphs(start:=1,
Length:=1).ParagraphFormat.Alignment = ppAlignCenter
Sl.Shapes.Title.TextFrame.TextRange.Font.Size = 18
Ch.ChartTitle.Font.ColorIndex = 15
Sl.Select
Set Grf = Sl.Shapes.AddOLEObject(Left:=20, Top:=110, Width:=630,
Height:=430, _
Filename:=ThisWorkbook.Path & "\" & ThisWorkbook.Name,
Link:=msoTrue)
Grf.LinkFormat.AutoUpdate = ppUpdateOptionManual

As you see the charttitle is used as the title of the slide and the real
charttitle is hidden.
I use a certain presentation over and over, removeing certain slides and
adding new ones.

Regards
Ernst Schuurman
 
D

Dale Fye

Thanks, Ernst.

I'll give this a try in the morning.

Ernst Schuurman said:
I use this code to copy charts into powerpoint presentation.

Set Dwbl = ThisWorkbook.Worksheets("sheetname")
Set Ch = ThisWorkbook.Charts(1)
Ch.Activate
Ch.ChartTitle.Font.Background = xlTransparent
Set ppt = New PowerPoint.Application
ppt.Visible = True
ppt.Presentations.Open "name.ppt"
Set Pres = ppt.ActivePresentation
Ch.Activate
Set Sl = Pres.Slides(n)
Sl.Shapes.Title.TextFrame.TextRange.Text = Ch.ChartTitle.Text
Sl.Shapes.Title.TextFrame.TextRange.Paragraphs(start:=1,
Length:=1).ParagraphFormat.Alignment = ppAlignCenter
Sl.Shapes.Title.TextFrame.TextRange.Font.Size = 18
Ch.ChartTitle.Font.ColorIndex = 15
Sl.Select
Set Grf = Sl.Shapes.AddOLEObject(Left:=20, Top:=110, Width:=630,
Height:=430, _
Filename:=ThisWorkbook.Path & "\" & ThisWorkbook.Name,
Link:=msoTrue)
Grf.LinkFormat.AutoUpdate = ppUpdateOptionManual

As you see the charttitle is used as the title of the slide and the real
charttitle is hidden.
I use a certain presentation over and over, removeing certain slides and
adding new ones.

Regards
Ernst Schuurman
 

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