jackson1990
Board Regular
- Joined
- Feb 21, 2017
- Messages
- 56
Hello everyone,
I'm very close to completing something I want to do, but I'm not quite understanding the last puzzle piece. My code is below:
So as you can see I am having excel create a slide for each row for the first four columns. It spits that out perfectly to a blank template. BUT I have created a custom template with a custom layout slide I want it to use (it is laid out better for the presentation of text). It is called PotP (the custom layout and template are both named this). I'm having trouble understanding (and I looked at various forums and threads to try to understand) how to get it to use a custom template/layout instead of just spitting it into the blank one.
Any help here?
I'm very close to completing something I want to do, but I'm not quite understanding the last puzzle piece. My code is below:
VBA Code:
Sub CopyCellAsTextBoxTextToPPTSlide()
'requires a reference to Microsoft PowerPoint
'In VBE: tools, references, check Microsoft PowerPoint X.0 Object Library
Dim oPPT As PowerPoint.Application
Dim oPres As Presentation
Dim oSld As Slide
Dim LR As Long, LC As Long
Set oPPT = CreateObject("PowerPoint.Application")
oPPT.Visible = True
Set oPres = oPPT.Presentations.Add
With ActiveSheet
LR = .Cells(.Rows.Count, 1).End(xlUp).Row
LC = .Cells(1, .Columns.Count).End(xlToLeft).Column
For i = 1 To LR
Set oSld = oPres.Slides.Add(i, ppBlank)
For j = 1 To LC
oSld.Shapes.AddTextbox msoTextOrientationHorizontal, 15, 50 * j + 5, 500, 10 'adjust numbers here to suit
oSld.Shapes(j).TextFrame.TextRange.Text = .Cells(i, j).Value
Next
Next
End With
End Sub
So as you can see I am having excel create a slide for each row for the first four columns. It spits that out perfectly to a blank template. BUT I have created a custom template with a custom layout slide I want it to use (it is laid out better for the presentation of text). It is called PotP (the custom layout and template are both named this). I'm having trouble understanding (and I looked at various forums and threads to try to understand) how to get it to use a custom template/layout instead of just spitting it into the blank one.
Any help here?