PowerPoint Slide from Template

Forestq

Active Member
Joined
May 9, 2010
Messages
482
Hi,

I'm adding empty slide. Then I want to set Template (slide 6 from 4x3_Cool_Template.potx). But I dont know how to use it?

Code:
newPowerPoint.ActivePresentation.Slides.Add newPowerPoint.ActivePresentation.Slides.Count + 1, ppLayoutBlanknewPowerPoint.ActiveWindow.View.GotoSlide newPowerPoint.ActivePresentation.Slides.Count
Set activeSlide = newPowerPoint.ActivePresentation.Slides(newPowerPoint.ActivePresentation.Slides.Count)
activeSlide.ApplyTemplate "C:\Program Files (x86)\Microsoft Office\Templates\Cisco\4x3_Cool_Template.potx"
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Have any luck with your question Forestq? I'm running into a similar issue trying to set the template for my newly created PPT.
 
Upvote 0
Hi,

I made empty formated template, I open it by vba and there I into selected slide I put all my charts and stats from excel file.
I can share the code if you want.
 
Upvote 0
here you go:

Code:
Application.DisplayAlerts = False
Application.ScreenUpdating = False

Dim wb As Workbook
Dim ws2, ws_SOP As Worksheet

Set wb = ActiveWorkbook
Set ws2 = wb.Worksheets("Sheet1")
Set ws_SOP = wb.Worksheets("Sheet2")

repored_period = ws_SOP.Range("B1").Value
theatr = ws_SOP.Range("B2").Value
filepathsave = ws_SOP.Range("B9").Value
file_template = ws_SOP.Range("B10").Value

Dim newPowerPoint As PowerPoint.Application
Dim activeSlide As PowerPoint.Slide
Dim cht As Excel.ChartObject
         
Set newPowerPoint = New PowerPoint.Application
newPowerPoint.Presentations.Open file_template

'********************************************* adding shapes
Set activeSlide = newPowerPoint.ActivePresentation.Slides(1)

activeSlide.Shapes.AddTextbox msoTextOrientationHorizontal, Left:=40, Top:=128, Width:=500, Height:=50
With activeSlide.Shapes(1).TextFrame
    .TextRange.Text = "TS Delivery Deck"
    .TextRange.Font.Color = RGB(255, 255, 254)
    .TextRange.Font.Name = "Arial (Headings)"
    .TextRange.Font.Size = 52
    .WordWrap = msoCTrue
End With
.
..
...
Set activeSlide = newPowerPoint.ActivePresentation.Slides(5)

ws2.Activate
ws2.ChartObjects("Chart 1").Chart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture
activeSlide.Shapes.Paste
        With activeSlide.Shapes(1)
            If .Type = msoPicture Then
                .Top = 60
                .Left = 20
                .Height = 200
                .Width = 200
            End If
        End With

ws2.Range("B20").CurrentRegion.Copy
activeSlide.Shapes.PasteSpecial ppPasteOLEObject
activeSlide.Shapes(4).Width = 500
activeSlide.Shapes(4).Height = 160
activeSlide.Shapes(4).Left = 40
activeSlide.Shapes(4).Top = 190
Application.CutCopyMode = False
.
..
...
newPowerPoint.ActivePresentation.SaveAs filepathsave & "\" & "your file name - " & theatr & " " & repored_period & ".pptx"
newPowerPoint.Quit

ws_SOP.Activate

Application.DisplayAlerts = True
Application.ScreenUpdating = True
 
Upvote 0
That's great, thanks! Let me see if I can get this to work now.

Is there any way you could provide the workbooks as well? I'm having a tough time following the commands.
 
Last edited:
Upvote 0
Is there any way you could also attach the workbook you're using? I'm having some trouble following the code at first glance. Thanks in advance.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,255
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top