Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. Dim PPT As Object
  2. Dim rng As Object
  3. Dim rng1 As Object
  4. Dim PowerPointApp As Object
  5. Dim myPresentation As Object
  6. Dim mySlide As Object
  7. Dim myShape As Object
  8. Dim ActivePresentation As Object
  9.  
  10.  
  11. 'Copy Range from Excel
  12. Set rng = Sheet3.ChartObjects("Chart 6")
  13. Set rng1 = Sheet3.ChartObjects("Chart 7")
  14. Set rng2 = Sheet3.ChartObjects("Chart 8")
  15.  
  16. Set PPT = CreateObject("PowerPoint.Application")
  17.  
  18. With PPT
  19. .Visible = True
  20. .WindowState = 1
  21. .Activate
  22. End With
  23. 'Is PowerPoint already opened?
  24. Set PowerPointApp = GetObject(class:="PowerPoint.Application")
  25.  
  26.  
  27. Set myPresentation = PowerPointApp.Presentations.Add *this should not say add as it adds a slide,but no luck with any other commands*
  28. ' PowerPointApp.Presentations.Add
  29. Set mySlide = myPresentation.Slides.Add(1, 11) *this should not say add as it adds a slide,but no luck with any other commands*
  30. 'Copy Excel Range
  31. rng.Copy
  32.  
  33. 'Paste to PowerPoint and position
  34. mySlide.Shapes.PasteSpecial DataType:=2 '2 = ppPasteEnhancedMetafile
  35. Set myShape = mySlide.Shapes(mySlide.Shapes.Count)
  36.  
  37. 'Set position:
  38. myShape.Left = 20
  39. myShape.Top = 152
  40.  
  41. rng1.Copy
  42. mySlide.Shapes.PasteSpecial DataType:=2 '2 = ppPasteEnhancedMetafile
  43. Set myShape = mySlide.Shapes(mySlide.Shapes.Count)
  44. myShape.Left = 486
  45. myShape.Top = 152
  46.  
  47. Set mySlide = myPresentation.Slides.Add(2, 11) '11 = ppLayoutTitleOnly
  48.  
  49. etc..
  50.  
  51.  
  52. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement