Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export Excel Charts to Powerpoint - Colours not coming across 1

Status
Not open for further replies.

shelby55

Technical User
Jun 27, 2003
1,229
CA
Hello

I am using Excel and PowerPoint 2003. I searched the threads and came up with the following code from lambuhere1:
Code:
Sub CopyCharts()
Dim oppt As New PowerPoint.Application
Dim pptpres As Presentation
Dim pptslide As Slide
Dim ch As Chart
Dim wkb As Workbook

'build a temporary workbook

this_path = ActiveWorkbook.Path
strtempwkb = this_path + "\" + "tempwkb.xls"

'create new presentation
oppt.Visible = msoTrue


Set pptpres = oppt.Presentations.Add
With pptpres.Slides

lheight = pptpres.PageSetup.SlideHeight
lwidth = pptpres.PageSetup.SlideWidth

'place each chart in slide

For Each ch In ActiveWorkbook.Charts

ch.Copy
Set wkb = ActiveWorkbook
wkb.SaveAs strtempwkb

Set pptslide = .Add(.Count + 1, ppLayoutBlank)
pptslide.Shapes.AddOLEObject Left:=(lwidth), Top:=(lheight), Width:=(lwidth), Height:=(lheight), Filename:=strtempwkb, link:=msoFalse


'close temp workbook and delete it
wkb.Close savechanges:=msoFalse

Kill strtempwkb
Next ch

End With
End Sub

With the above, the images are pasting to the bottom right of the slide (not on the slide) so I have to move them up AND the colours are not as used in Excel. How can this be fixed? Thanks.
 
Hi

I just did a test and the reason the colours are changing is because they are custom colours. Is there any way to maintain colours even if custom in Excel?

Thanks.

 
When you access OLEFormat object you can set the FollowColors property according to your needs (ppFollowColorsScheme, ppFollowColorsNone, other)

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top