none
Error: To Copy data(worksheets) from Excel worksheets to Powerpoint in a particular slide by using EXCEL VBA RRS feed

  • General discussion

  • Private Sub CommandButton2_Click()

      Dim PP As PowerPoint.Application
      Dim PPpres As PowerPoint.Presentation
      Dim PPslide As Object
      Dim PpShape As PowerPoint.Shape
      Dim SlideTitle As String
      Dim SlideNum As Integer
      Dim WSrow As Long
      Dim Sh As Shape
      Dim Rng As Range
      Dim myshape As Object
      
      'Open PowerPoint and create new presentation
    Set PP = GetObject(class, "PowerPoint.Application")
    PP.Visible = True
    PP.Presentations.Open Filename:="\\F:\Users\C42096\Userdata\Desktop\CMDB\EOS Platforms\EOL EOS All Domains_Template1.pptx"


     'Specify the chart to copy and copy it
     For Each WS In Worksheets
        If (WS.Name) <> "EOS" Then
            ThisWorkbook.Worksheets(WS.Name).Activate
            ThisWorkbook.ActiveSheet.UsedRange.CopyPicture
    '        pSlide.Shapes.Paste
     'Copy Range from Excel
      Set Rng = ThisWorkbook.ActiveSheet.Range("A1:I8")

    'Copy Excel Range
      Rng.Copy
      
      
    'Set PPslide = PPpres.Slides.Add(5, 33)
     PP.ActiveWindow.View.GotoSlide (4)
    'Paste to PowerPoint and position
    PPslide.Shapes.PasteSpecial DataType:=2   '2 = ppPasteEnhancedMetafile
      Set myshape = PPslide.Shapes(PPslide.Shapes.Count)
      
        'Set position:
          myshape.Left = 66
          myshape.Top = 152

    'Make PowerPoint Visible and Active
      PowerPointApp.Visible = True
      PowerPointApp.Activate

    End If
    Next
    'Clear The Clipboard
      Application.CutCopyMode = False
    End Sub
    Sunday, May 21, 2017 11:01 AM