当我尝试保存PPT文件时Vba错误

时间:2019-02-25 12:38:17

标签: vba powerpoint

我是编码初学者,我正在尝试编写代码以将ppt文件保存为pdf。但是,我收到消息“运行时错误424”为必需对象”,该如何解决?

有我的代码:

Sub AbrirPP()

Dim ppPres As Object
Set ppPres = CreateObject("PowerPoint.Application")

With ppPres  
    .Visible = True
    .Presentations.Open "C:\Users\Fede\Documents\Prueba.pptx"
    .ActivePresentation.UpdateLinks

    With ActivePresentation
        .SaveCopyAs _
            Filename:=.Path & "\" & ActivePresentation.Name & Format(Now, "yyyy-mm-dd") & ".pdf", _
            FileFormat:=ppSaveAsPDF
    End With
End With

Set ppPre = Nothing

End Sub

0 个答案:

没有答案