简体   繁体   中英

Macro to save a powerpoint presentation

I have a powerpoint presentation embedded in Excel which I am opening using a macro and then I would like to save the open presentation to the C Drive

I tried the below code but unable to save the powerpoint to the required destination.

Sub openppt()

Dim ppPres  As PowerPoint.Presentation
Set ppApp = New PowerPoint.Application
Todate = Date
Sheets("SupportData").Select
ActiveSheet.Shapes.Range(Array("Object 7")).Select
Selection.Verb Verb:=3
activeSlide.SaveAs "C:\Release_Review\" & "Release_Review" & Todate & 
".pptx"
End Sub

I would like the open slide to be saved in C:\Release_Review\ and then name should be Release_ReviewTodays_date

First, you can refer to your object using the OLEObject object. Secondly, 3 does not appear to be a valid verb. Try the following instead...

Sub openppt()

    Dim oleObj As OLEObject
    Set oleObj = Worksheets("SupportData").OLEObjects("Object 7")

    oleObj.Verb xlVerbOpen

    Dim pres As Object
    Set pres = oleObj.Object

    pres.SaveAs "C:\Release_Review\Release_Review" & Date & ".pptx"

End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM