如何在Excel中使用VBA将Powerpoint作为PDF使用加载项PDFMaker保存?

我使用Excel中的VBA从Excel中更新Powerpoint演示文稿和图表等。 我想要做的是使用Powerpoint中的PDFMaker插件从VBA代码中将该演示文稿另存为PDF。 我想使用加载项的原因是,PDF的质量比普通的“另存为PDF”更好。

我在Windows 7上使用Office 2010和Adobe Acrobat XI Standard。

我的代码工作正常,直到我到达调用CreatePDFEx方法的阶段。 然后我得到错误:

“”“运行时错误”-2147023170“

自动化错误远程过程调用失败。 “””

这是我使用的代码的一部分,在代码前面指定了“pdfname”:

Dim pmkr As AdobePDFMakerForOffice.PDFMaker Dim stng As AdobePDFMakerForOffice.ISettings Dim pdfname As String Dim a As Object Set pmkr = Nothing ' locate PDFMaker object For Each a In pptApp.COMAddIns If InStr(UCase(a.Description), "PDFMAKER") > 0 Then Set pmkr = a.Object Exit For End If Next If pmkr Is Nothing Then MsgBox "Cannot Find PDFMaker add-in", vbOKOnly, "" Exit Sub End If If Dir(pdfname) <> "" Then Kill pdfname pmkr.GetCurrentConversionSettings stng stng.AddTags = True stng.AddLinks = True stng.AddBookmarks = True stng.FitToOnePage = True stng.ConvertAllPages = True stng.OutputPDFFileName = pdfname stng.PromptForPDFFilename = False stng.ShouldShowProgressDialog = True stng.ViewPDFFile = False pmkr.CreatePDFEx stng, 0 ' perform conversion If Dir(pdfname) = "" Then ' see if conversion failed MsgBox "Could not create " & pdfname, vbOKOnly, "Conversion failed" End If Set pmkr = Nothing Set stng = Nothing End Sub 

有谁知道为什么我得到这个错误,我能做些什么呢?