paddysheeran
07-29-2013, 01:57 AM
Hi All,
I'm using the following piece of code to open a PowerPoint presentation and save the slides as images for insertion into a word document.
Dim PPT As PowerPoint.Application
Set PPT = New PowerPoint.Application
PPT.Presentations.Open Filename:=ActiveWorkbook.Path & "\Conferencing_Dashboard" & ".pptx"
Dim sImagePath As String
Dim sImageName As String
Dim oSlide As Slide '* Slide Object
On Error GoTo Err_ImageSave
'sImagePath = ActivePresentation.Path
Filename = 1
For Each oSlide In PPT.ActivePresentation.Slides
sImageName = oSlide.Name & ".jpg"
oSlide.Export ActiveWorkbook.Path & "\" & Filename, "JPG"
Filename = Filename + 1
Next oSlide
Err_ImageSave:
If Err <> 0 Then
MsgBox Err.Description
End If
PPT.Activate
PPT.Quit
Set PPT = Nothing
The code works fine but PPT.Quit does not close down PowerPoint. Can anyone help?
thanks,
Paddy.
I'm using the following piece of code to open a PowerPoint presentation and save the slides as images for insertion into a word document.
Dim PPT As PowerPoint.Application
Set PPT = New PowerPoint.Application
PPT.Presentations.Open Filename:=ActiveWorkbook.Path & "\Conferencing_Dashboard" & ".pptx"
Dim sImagePath As String
Dim sImageName As String
Dim oSlide As Slide '* Slide Object
On Error GoTo Err_ImageSave
'sImagePath = ActivePresentation.Path
Filename = 1
For Each oSlide In PPT.ActivePresentation.Slides
sImageName = oSlide.Name & ".jpg"
oSlide.Export ActiveWorkbook.Path & "\" & Filename, "JPG"
Filename = Filename + 1
Next oSlide
Err_ImageSave:
If Err <> 0 Then
MsgBox Err.Description
End If
PPT.Activate
PPT.Quit
Set PPT = Nothing
The code works fine but PPT.Quit does not close down PowerPoint. Can anyone help?
thanks,
Paddy.