Hi All
I'm having some difficulty re-sizing a chart I've imported into a powerpoint template. The below code copies the chart to Powerpoint just fine, the problem starts where the re-sizing is supposed to take place (highlighted red), then I get a run-time error "Object Required" message.
Any help would be greatly appreciated.
Sub ProgressCurveSlide()
Dim PPApp As PowerPoint.Application
Dim PPSlide As PowerPoint.Slide
Dim PPPres As PowerPoint.Presentation
Set PPApp = CreateObject("PowerPoint.Application")
Dim SlideNum As Integer
Dim PPShape As Object
Set XLApp = GetObject(, "Excel.Application")
Application.ScreenUpdating = False
'define input PowerPoint template
Dim strPresPath As String, strExcelFilePath As String, strNewPresPath As String
'set srtPresPath as path location of PowerPoint template
strPresPath = "C:\1. OS2\16. Presentations\OS2 Template\OS2 Template.pptm"
'set strNewPresPath as path location for where it is to be saved
strNewPresPath = "C:\1. OS2\16. Presentations\Construction Progress Curve\OS2 Construction Progress Curve.pptm"
Set PPPres = PPApp.Presentations.Open(strPresPath)
PPPres.Application.Activate
PPApp.Visible = True
'define destination slide
SlideNum = 1
PPPres.Slides(SlideNum).Select
Set PPSlide = PPPres.Slides(PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)
'define source sheet
Sheets("Progress Curves").Activate
'copy & paste from
ActiveSheet.ChartObjects("Chart 52").Activate
ActiveChart.ChartArea.Copy
Set PPShape = PPSlide.Shapes.PasteSpecial(DataType:=ppPasteEnhancedMetafile, Link:=msoFalse)
PPShape.Height = 3.06 * 72
PPShape.Width = 9.4 * 72
PPShape.Left = 0.34 * 72
PPShape.Top = 1.24 * 72
'save presentation
PPPres.SaveAs strNewPresPath
'clean up
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
Application.ScreenUpdating = True
End Sub
Bookmarks