2 Replies Latest reply: Jun 22, 2016 6:04 AM by xia ZHU RSS

    Exporting to ppt

    krishna b

      Hi all,

       

      I got error in macro. how to resolve this.

       

      Error:

       

      Object required: 'ActiveDocument.GetSheetObject(...)'

       

      Macro code:

       

      Sub ppt

      'An array with the objects you want to export to powerpoint
      Dim myArray(4)
      myArray(0) = "CH01"
      myArray(1) = "CH02"
      myArray(2) = "CH03"
      myArray(3) = "CH04"
      myArray(4) = "CH05"

      'Create ppt object
      Set objPPT = CreateObject("PowerPoint.Application")
      objPPT.Visible = True
      Set objPresentation = objPPT.Presentations.Add

      'Apply a template if you want one
      'objPresentation.ApplyTemplate _
      ' ("C:\mytemplate.potx")

      'For each object in the array create a new slide and paste it.
      For each item in myArray

      Set PPSlide = objPresentation.Slides.Add(1,11)
      ActiveDocument.GetSheetObject(item).CopyBitmapToClipboard
      PPSlide.Shapes.Paste

      Next

      'Clean up
      Set PPSlide = Nothing
      Set PPPres = Nothing
      Set PPApp = Nothing

      End Sub

       

      Thanks,

      Krishna