5 Replies Latest reply: Nov 27, 2013 1:36 AM by Cs Khoo RSS

    Export every sheets to PPT

      Dear Community,

       

      To export sheet to PPT by using macro, I have the code as shown below, but it's working weird as it only export one of the sheet image to PPT while the other 2 sheet images in blank.

      Kindly give a hint to correct my code.

       

      Sub ppt

      Dim myArray(2)

      myArray(0) = "SH_Media_Performance"          'my sheet ID_1

      myArray(1) = "SH_Catalogues"                         'my sheet ID_2

      myArray(2) = "SH_Executive_Summary"               'my sheet ID_3


      Set objPPT = CreateObject("PowerPoint.Application")

      objPPT.Visible = True

      Set objPresentation = objPPT.Presentations.Add


      For count = 0 to ubound(MyArray)

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

      ActiveDocument.Sheets(myArray(count)).Activate

      Set t=ActiveDocument.ActiveSheet

      t.CopyBitmapToClipboard

      PPSlide.Shapes.Paste

       

      if count = 3 then exit sub

      Next

      Set PPSlide = Nothing

      Set PPPres = Nothing

      Set PPApp = Nothing

       

      End Sub


      The weird PPT came out after running the macro, the correct result should show 3 sheet images in 3 slides.

      Capture.PNG.png

       

      Warm regards,

      Chanel