OliverBrain
New Member
- Joined
- Mar 19, 2015
- Messages
- 30
I am trying to insert a PDF file into a powerpoint slide and have a link between the file and powerpoint.
I have written some code that first creates a PDF of some data from Excel. The code then opens a new powerpoint presentation and adds a title slide and an additional slide. I would like to be able to insert PDF into my second powerpoint slide.
Any suggestions:
<code style="margin: 0px; padding: 0px; font-style: inherit;">Sub SavePDF()
Dim PDFRange As Excel.Range
Dim Filename As String
Dim ppApp As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
Dim ppSlide As PowerPoint.Slide
'sets the range I want as PDF
Set PDFRange = ThisWorkbook.Worksheets("sheet1").Range("Range_Test")
Filename = "Pilot Presentation" & " " _
& Format(Now, "dd-mmm-yy")
'Exports range and saves as given filename
PDFRange.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Filename, Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=True
'Opens Powerpoint
Set ppApp = New PowerPoint.Application
ppApp.Visible = True
ppApp.Activate
'Adds new presentation and Title slide
Set ppPres = ppApp.Presentations.Add
Set ppSlide = ppPres.Slides.Add(1, ppLayoutTitle)
'Refers to the shapes within the title slide and input what you want
ppSlide.Shapes(1).TextFrame.TextRange = "End of Pilot Presentation"
ppSlide.Shapes(2).TextFrame.TextRange = "Client Name"
'Adds second slide
Set ppSlide = ppPres.Slides.Add(2, ppLayoutBlank)
ppSlide.Select
ppSlide.InsertFromFile("c:\Test PDF 04-Jun-15.pdf") 'attempt, not sure what I am doing here
End Sub</code>
I have written some code that first creates a PDF of some data from Excel. The code then opens a new powerpoint presentation and adds a title slide and an additional slide. I would like to be able to insert PDF into my second powerpoint slide.
Any suggestions:


<code style="margin: 0px; padding: 0px; font-style: inherit;">Sub SavePDF()
Dim PDFRange As Excel.Range
Dim Filename As String
Dim ppApp As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
Dim ppSlide As PowerPoint.Slide
'sets the range I want as PDF
Set PDFRange = ThisWorkbook.Worksheets("sheet1").Range("Range_Test")
Filename = "Pilot Presentation" & " " _
& Format(Now, "dd-mmm-yy")
'Exports range and saves as given filename
PDFRange.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Filename, Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=True
'Opens Powerpoint
Set ppApp = New PowerPoint.Application
ppApp.Visible = True
ppApp.Activate
'Adds new presentation and Title slide
Set ppPres = ppApp.Presentations.Add
Set ppSlide = ppPres.Slides.Add(1, ppLayoutTitle)
'Refers to the shapes within the title slide and input what you want
ppSlide.Shapes(1).TextFrame.TextRange = "End of Pilot Presentation"
ppSlide.Shapes(2).TextFrame.TextRange = "Client Name"
'Adds second slide
Set ppSlide = ppPres.Slides.Add(2, ppLayoutBlank)
ppSlide.Select
ppSlide.InsertFromFile("c:\Test PDF 04-Jun-15.pdf") 'attempt, not sure what I am doing here
End Sub</code>