A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Here’s how to use a template:
Dim strPptTemplatePath As String
strPptTemplatePath = "C:\temp\My PowerPoint Template.potx"
'Get the PowerPoint Application object:
Set ppt = CreateObject("PowerPoint.Application")
ppt.Visible = msoTrue
Set pptPres = ppt.Presentations**.Open(strPptTemplatePath, untitled:=msoTrue)**
Yes, you can make charts copy into a certain part of the slide, but not like in Word.
There are two ways to do this. Either you just paste the charts on to the slide and then reposition and re-size in VBA, or you set up / use a Custom Layout in your template – this would be my preference.
The code as is finds a Custom Layout named “Title and Content”. That should have a Placeholder for objects (as well as a Title placeholder).
Then the code looks through all the placeholders on the new slide to find the Placeholder for objects. If you have more than one Placeholder for objects, you’d need to do a test to see if the position is correct, for example:
'Find the right placeholder to paste into:
For Each pptShp In pptSld.Shapes.Placeholders
If pptShp.PlaceholderFormat.Type = ppPlaceholderObject Then
If pptShp.Left = 50 Then Exit For
End If
Next pptShp
Do you need to put specific charts in a specific order of slides? In which case, you’ll need to give me some examples of chart names (as shown on thethe right of the Chart Tools > Layout tab when your chart is selected), and where you want them to be pasted.
Cheers
Rich