Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'declare the variables
- Dim activePowerPoint As PowerPoint.Application
- Dim activeSlide As PowerPoint.Slide
- Dim cht As Excel.ChartObject
- Dim rng As Range
- 'Copy Range from Excel
- 'Look for existing instance
- On Error Resume Next
- Set newPowerPoint = GetObject(, "PowerPoint.Application")
- On Error GoTo 0
- 'Show the PowerPoint
- newPowerPoint.Visible = True
- 'Add a new slide where we will paste the chart
- newPowerPoint.ActivePresentation.Slides.Add newPowerPoint.ActivePresentation.Slides.Count + 1, ppLayoutText
- newPowerPoint.ActiveWindow.View.GotoSlide newPowerPoint.ActivePresentation.Slides.Count
- Set activeSlide = newPowerPoint.ActivePresentation.Slides(newPowerPoint.ActivePresentation.Slides.Count)
- 'Copy the chart and paste it into the PowerPoint as a Metafile Picture
- rng.Copy
- activeSlide.Shapes.PasteSpecial(DataType:=ppPasteMetafilePicture).Select
- 'Adjust the positioning of the Chart on Powerpoint Slide
- newPowerPoint.ActiveWindow.Selection.ShapeRange.Left = 0
- newPowerPoint.ActiveWindow.Selection.ShapeRange.Top = 0
- activeSlide.Shapes(2).Width = 200
- activeSlide.Shapes(2).Left = 505
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement