2 Replies Latest reply: Aug 22, 2016 9:48 AM by Santiago Respane RSS

    Macro to export all charts all sheets to PPT as one chart per slide

      The macro in attached qvw example exports all charts all sheets to PPT as one chart per slide.

       

       

      Code:

      Sub Export_All_Chart_Images()

          set objPPT = CreateObject("PowerPoint.Application")

        objPPT.Visible = True

        Set objPresentation = objPPT.Presentations.Add

       

       

        For i = 0 To ActiveDocument.NoOfSheets - 1

              Set MySheet = ActiveDocument.GetSheet(i)

       

              MyCharts=MySheet.GetSheetObjects

                  For X =lbound(MyCharts) to ubound(MyCharts)

                         

         Set PPSlide = objPresentation.Slides.Add(i+X+1,11)

                          'msgbox("Chart: " & MyCharts(X).GetObjectId)

                           Set obj = ActiveDocument.GetSheetObject(MyCharts(X).GetObjectId)

                           IF Obj.GetObjectType >= 10 AND Obj.GetObjectType =< 16 Then           

        obj.CopyBitmapToClipboard

        PPSlide.Shapes.Paste

       

        End if

                  Next

          Next 

          Set PPSlide = Nothing

        Set PPPres = Nothing

      End Sub