Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim PPT As Object
- Dim rng As Object
- Dim rng1 As Object
- Dim PowerPointApp As Object
- Dim myPresentation As Object
- Dim mySlide As Object
- Dim myShape As Object
- Dim ActivePresentation As Object
- 'Copy Range from Excel
- Set rng = Sheet3.ChartObjects("Chart 6")
- Set rng1 = Sheet3.ChartObjects("Chart 7")
- Set rng2 = Sheet3.ChartObjects("Chart 8")
- Set PPT = CreateObject("PowerPoint.Application")
- With PPT
- .Visible = True
- .WindowState = 1
- .Activate
- End With
- 'Is PowerPoint already opened?
- Set PowerPointApp = GetObject(class:="PowerPoint.Application")
- Set myPresentation = PowerPointApp.Presentations.Add *this should not say add as it adds a slide,but no luck with any other commands*
- ' PowerPointApp.Presentations.Add
- Set mySlide = myPresentation.Slides.Add(1, 11) *this should not say add as it adds a slide,but no luck with any other commands*
- 'Copy Excel Range
- rng.Copy
- 'Paste to PowerPoint and position
- mySlide.Shapes.PasteSpecial DataType:=2 '2 = ppPasteEnhancedMetafile
- Set myShape = mySlide.Shapes(mySlide.Shapes.Count)
- 'Set position:
- myShape.Left = 20
- myShape.Top = 152
- rng1.Copy
- mySlide.Shapes.PasteSpecial DataType:=2 '2 = ppPasteEnhancedMetafile
- Set myShape = mySlide.Shapes(mySlide.Shapes.Count)
- myShape.Left = 486
- myShape.Top = 152
- Set mySlide = myPresentation.Slides.Add(2, 11) '11 = ppLayoutTitleOnly
- etc..
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement