Saving all open PPT within Excel

Adam_P

New Member
Joined
Aug 26, 2018
Messages
3
Hi all - thank you so much with my previous question (literally saved me hours each month!)

Question
I have an Excel Workbook that exports standardised reports each month directly in to a fresh PowerPoint file. This works great, but the problem I have is that I suddenly have 20 open PowerPoint presentations and saving manually takes a frustratingly long time.

Is there a way (within Excel) to save (and close) all of these newly created reports in PowerPoint to a specific destination?

Thanks again!
Adam
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi Adam,

Try this:

VBA Code:
Option Explicit
Sub Macro1()

    Dim objPP_App As Object
    Dim objPP_Pres As Object
    Dim i As Long
    Dim strSavePath As String
    
    Application.ScreenUpdating = False
    
    On Error Resume Next
        'Check if an instance of PowerPoint exists
        Set objPP_App = GetObject(, "PowerPoint.Application")
        'If it does, then...
        If Err.Number = 0 Then
            '...save each open PowerPoint file into the 'strSavePath' path and then close the file.
            strSavePath = "C:\MS_Office\PowerPoint\Test" 'Path where the open PowerPoint files are to be saved. Change to suit.
            strSavePath = IIf(Right(strSavePath, 1) <> "\", strSavePath & "\", strSavePath)
            For i = objPP_App.Presentations.Count To 1 Step -1
                Set objPP_Pres = objPP_App.Presentations(i)
                objPP_Pres.SaveAs strSavePath & objPP_Pres.Name
                objPP_Pres.Close
            Next i
        End If
    On Error GoTo 0
    
    Application.ScreenUpdating = True
    
End Sub

Regards,

Robert
 
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,107
Members
452,302
Latest member
TaMere

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