Thanks to Alpha frog for helping me with code below.
I need to alter it again, so need you Guys help
What this code does-
Ok this code copies chart from excel and pasted into a new PPT
what I want it to do now-
I want the code to be edited so that in place of a chart it copies the picture in the excel as I am having picture now in excel sheet rather then chart.
![]()
Sub PushChartsToPPT() 'Set reference to 'Microsoft PowerPoint 12.0 Object Library' 'in the VBE via Tools > References... ' Dim ppt As PowerPoint.Application Dim pptPres As PowerPoint.Presentation Dim pptSld As PowerPoint.Slide Dim pptCL As PowerPoint.CustomLayout Dim pptShp As PowerPoint.Shape Dim cht As Chart Dim ws As Worksheet Dim i As Long 'Get the PowerPoint Application object: Set ppt = CreateObject("PowerPoint.Application") ppt.Visible = msoTrue Set pptPres = ppt.Presentations.Add 'Get a Custom Layout: For Each pptCL In pptPres.SlideMaster.CustomLayouts If pptCL.Name = "Title and Content" Then Exit For Next pptCL 'Copy ALL charts embedded in Active WorkSheet: Set ws = ActiveSheet For i = 1 To ws.ChartObjects.Count Set pptSld = pptPres.Slides.AddSlide(pptPres.Slides.Count + 1, pptCL) pptSld.Select For Each pptShp In pptSld.Shapes.Placeholders If pptShp.PlaceholderFormat.Type = ppPlaceholderObject Then Exit For Next pptShp Set cht = ws.ChartObjects(i).Chart pptSld.Shapes(1).TextFrame.TextRange.Text = cht.ChartTitle.Text cht.ChartArea.Copy ppt.Activate pptShp.Select ppt.Windows(1).View.Paste Next i End Sub











LinkBack URL
About LinkBacks
Register To Reply

Bookmarks